Object.create()
Object.creat = function (o) {
function F() {};
F.prototype = o;
return new F;
}
new
function Person (name) {
this.name = name;
}
function createObject (Base) {
var args = [].slice.call(arguments, 1);
var o = new Object;
o.__proto__ = Base.prototype;
Base.protype.constructor = Base;
Base.apply(o, args);
return o;
}

推荐阅读
网友评论