typeof能识别所有值类型,识别函数。
typeof能识别所有引用类型(不能继续识别为null还是object还是array)
考点:JS变量类型(变量类型的检测,对象数组的深浅拷贝等)
// 基本数据类型:string number Boolean object undefined null symbol
typeof 'a' // 'string'
typeof 1 // 'number'
typeof true // 'boolean'
typeof null // 'object'
typeof {} // 'object'
typeof [] // 'object'
typeof undefined // 'undefined'
typeof Symbol('a') // symbol
typeof function(){} // 'function'