JS怎么判断数据类型

2021-12-17  本文已影响0人  i_木木木木木
typeof("")  //string
typeof([])  //object
typeof({})  //object
Array.isArray("")  //false
Array.isArray({})  //false
Array.isArray([])  //true
let a="",b=[],c={};
a. constructor === String   //true
b. constructor === Array   //true
c. constructor === Object   //true
上一篇 下一篇

猜你喜欢

热点阅读