标签:js
string类型 var a = "a"
typeof a === "string"
let a = 111
typeof a === "number"
var a = function(){}
typeof a === "function"
var a =undefined
typeof a === "undefined"
a === undefined
var a = []
a instanceof Array
Array.isArray(a)
var a =null
a instanceof null
a === null
var a = /a/g
a instanceof RegExp
var a = {}
typeof a === "object"
a instanceof Object
注意:Object,Array,null,RegExp都会判断为Object,请把Object放在最后一种类型判断
标签:js
原文地址:http://blog.51cto.com/13661873/2089344