function typeofLation(type) {
if (type === null) {
return null
} else if (typeof type === 'object') {
const res = {
"[object Object]": "[object Object]",
"[object Array]": "[object Array]",
"[object Function]": "[object Function]"
}
const _t = Object.prototype.toString.call(type)
return res[_t]
} else {
return typeof type
}
}
JavaScript 手写typeof
最新推荐文章于 2022-05-05 21:27:19 发布