Object.prototype.toString.call 判断变量类型
使用Object.prototype.toString.call判断变量的类型
Object.prototype.toString.call(123)
"[object Number]"
Object.prototype.toString.call({})
"[object Object]"
Object.prototype.toString.call([])
"[object Array]"
Object.prototype.toString.call(null)
"[object Null]"
Object.prototype.toString.call(undefined)
"[object Undefined]"
Object.prototype.toString.call('abc')
"[object String]"
Object.prototype.toString.call(true)
"[object Boolean]"
Object.prototype.toString.call(NaN)
"[object Number]"