JS中的數據類型檢測方法總結

目錄 typeof instanceof constructor Object.prototype.toString.call typeof 語法:typeof [val],返回當前值val對應的數據類型(返回結果是一個字符串) 檢測基本類型——仍是蠻準的,除了一個BUG:typeof null === ‘object’ 檢測引用類型——並不能細分具體的對象類型(如數組對象、正則對象等) inst
相關文章
相關標籤/搜索