- 识别所有值类型
- 识别函数
- 识别是否是引用类型(不可再细分)
// 识别所有值类型let a //undefined typeof a // 'undefined'const s = 'abc' typeof s // 'string'const n = 100 typeof n // 'number'const b = true typeof b // 'boolean'const s = Symbol('s') typeof s // 'symbol'
// 能判断函数typeof console.log // 'function'typeof function () {} // 'function'
// 能识别引用类型(不能再继续识别)typeof null // 'object'typeof ['a', 'b'] //'object'typeof { x: 100 } //'object'
