function typeOf(obj) {
return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase()
},
typeOf('123') // string
typeOf([]) // array
typeOf({}) // object
js如何判断数据类型
最新推荐文章于 2023-07-07 08:24:54 发布
function typeOf(obj) {
return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase()
},
typeOf('123') // string
typeOf([]) // array
typeOf({}) // object