# 判断类型(可以区分null和object)
type = para => {
return Object.prototype.toString.call(para).match(/\[([^]*)\]/)[1].split(" ")[1]
}
type = para => {
console.log(Object.prototype.toString.call(para))
return Object.prototype.toString.call(para).match(/\[([^]*)\]/)[1].split(" ")[1]
}
console.log(type(null))// //[object Null] Null
console.log(type({}))//[object Object] Object
console.log(type([]))//[object Array] Array