function pp(json) { this.x = (json.x != null) ? json.x : '未知'; this.xx = (json.xx != null) ? json.xx : this.x / 2;
}function zz(x){ this.x = x;
}
zz.prototype = new pp({});然后var zz = new zz(50);
alert(zz.x + '---' + zz.xx);alert 顯示的數據是 50 和 0 ,怎樣才能簡便的實時更新繼承 pp 的 xx 的值?我想要的是 25。求解惑
js 中 prototype 繼承問題
精慕HU
2018-09-05 16:33:02