function Parent() {
this.color = ['pink', 'red'];
}function createAnother(o) {
// 獲得當前對象的一個克隆
var another = new Object(o);
// 增強對象
o.sayHi = function() {
console.log('Hi');
}
// 返回對象
return another;
}
在js繼承當中,這種寄生式繼承當中什么叫做獲得當前對象的一個克隆呀
函數式編程
2018-07-08 10:22:17