prototypeprototype
prototype
prototype
prototype
Hogeprototype m1 m1
Hoge.prototype;
// -> { m1: [Function] }
Hoge.m1();
//
Hoge`Object.getPrototypeOf(Hoge)` Hoge`Function.prototype`callFunction.prototype.call
Object.getPrototypeOf(Hoge) === Function.prototype
// -> true
Hoge.call == Function.prototype.call
// -> true
prototypenewnew prototype
hoge = new Hoge(1);
Hoge.prototype === Object.getPrototypeOf(hoge);
// -> true
new prototype
__proto__
hoge.__proto__ = {
m2: function() {
return this;
}
};
hoge.m2()
// -> Object { p1: "1" }
hoge.m1()
// :
// hogenew(Hogeprototype)
// m1
__proto__