判断数据类型

判断数据类型

有的数据类型
boolean string number undefind unll function object array

  1. typeof
    typeof 对 boolean string number undefined function 有效 除去 function 其他的引用类型都是 object

  2. 判断数组用 Array.isArray()

  3. instanceof

  4. Object.prototype.toString.call