我有这样的代码
'use strict';
let log = console.log;
let cParent = function () {
this.property1 = arguments[0] || null;
this.property2 = arguments[1] || null;
this.log = function () {
log('log: ', this.property1);
}
};
let obj1 = new cParent(4, 5);
log(obj1.prototype);
log(Object.getPrototypeOf(obj1));
log(cParent.prototype);
log(Object.getPrototypeOf(cParent));
得到的结果是
undefined
{}
{}
[Function]
相关分类