JavaScriptのObject.creat()とnew()
227 ワード
Object.create = function (obj) {
function F() {}
F.prototype = obj;
return new F();
};
var
obj = {};
obj.__proto__ = Base.prototype;
・Base.call(obj);
Object.create = function (obj) {
function F() {}
F.prototype = obj;
return new F();
};
var
obj = {};
obj.__proto__ = Base.prototype;
・Base.call(obj);