![](/img/trans.png)
[英]Why performance.hasOwnProperty('getEntries') returns false while typeof performance.getEntries returns function?
[英]Why hasOwnProperty returns false on a constructor function but string property returns true when accessed without instantiating the function
如果您检查 typeof Shape 它将返回一个“函数”但 typeof s 将返回“对象”
当你调用 var s = new Shape(); Shape 将被视为类,但名称和大小是 Shabe 类的成员。
默认构造函数将调用 new Shape() 并创建一个 Shape 对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.