### typeof数据类型检测 * * * * * > 在编程人员编码过程中经常会遇到“检测某个变量或者参数是什么类型”的问题,javascript语言api为我们提供了typeof操作符来检查 ~~~ let i = 0 console.log(typeof i) // number let o = "0" console.log(typeof o) //string let u = true console.log(typeof u) //boolean let n = null console.log(typeof n) //object let r = new object console.log(typeof r) //object let j = function(){ } console.log(typeof j) //function let s = Symbol(); console.log(typeof s) //symbol let m = [] console.log(typeof m) //object /* 因为数组也是对象,所以数组的数据类型就是对象 */ console.log(typeof null) //object 关于为什么null也是对象,还记得null是什么吗?(空指针对象) console.log(typeof undefined) //undefined ~~~