getType
获取数据类型
examples
source code
getType(1) //string
getType(2) //number
getType(true) //boolean
getType([object Set]) //set
getType([object Map]) //map
getType(Fri Mar 22 2024 07:14:21 GMT+0000 (Coordinated Universal Time)) //date
getType([object Object]) //object
getType(function anonymous( ) { }) //function
getType(undefined) //undefined
getType(null) //null
const getType = (value) => {
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
};