常见类型判断
一、判断方法总结
const types = {
str: 'hello',
strObj: new String('hello'),
num: 123,
bool: true,
'null': null,
'undefined': undefined,
symbol: Symbol(),
bigInt: 9007199254740991n,
fun: function () {},
arr: [],
obj: {},
map: new Map(),
weakMap: new Map(),
set: new Set(),
weakSet: new Set()
}类型
typeof
instanceof [constructor]
Object.prototype.toString.call
二、应用:深拷贝
Last updated