![](/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.