`obj.prototype` 和 `Object.getPrototypeOf(obj)`

我有这样的代码

'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]


慕斯709654
浏览 838回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript