function myTypeof(x) {
let a = Object.prototype.toString.call(x).slice(8, -1).toLowerCase()
let t = [
'number',
'bigint',
'string',
'symbol',
'function',
'boolean',
'undefined'
]
if (t.indexOf(a) != -1)
return a
else
return 'object'
}
手写typeof
最新推荐文章于 2024-09-24 11:55:49 发布
关键词由CSDN通过智能技术生成