/**
* @desc Javascript 判断用户类型
*/
let num = 9
let str ='nice'
let arr = [1,2]
let obj = {name:'iu'}
let boo = false
let fun = ()=>{}
let nu = null
let un = undefined
let na = NaN
function format(data) {
return Object.prototype.toString.call(data).slice(8,-1)
}
console.log(format(num)) // Number
console.log(format(str)) // String
console.log(format(arr)) // Array
console.log(format(obj)) // Object
console.log(format(boo)) // Boolean
console.log(format(fun)) // Function
console.log(format(nu)) // Null
console.log(format(un)) // Undefined
console.log(format(na)) // Number
console