1

我是 JS 新手,我想知道为什么这段代码打印错误。我究竟做错了什么?谢谢你的任何提示!

var x = Object.create(Object.prototype, {x:{value:3, writable:true, enumerable:true}});

console.log(x.propertyIsEnumerable(x)); //false
4

1 回答 1

1

好吧,你错过了报价:

x.propertyIsEnumerable('x')

见下文:

var x = Object.create(Object.prototype, {x:{value:3, writable:true, enumerable:true}});

console.log(x.propertyIsEnumerable('x'));

于 2017-08-12T15:45:01.520 回答