js检测数据类型完美兼容所有数据类型
let a = ""//undefined/null/new Function/new Object/{}/new Date()/"" console.log("33",Object.prototype.toString.call(a)) console.log(Object.prototype.toString.call(a) === `[object String]`) //-------> true; console.log(Object.prototype.toString.call(a) === `[object Number]`) //-------> true; console.log(Object.prototype.toString.call(a) === `[object Array]`) //-------> true; console.log(Object.prototype.toString.call(a) === `[object Date]`) //-------> true; console.log(Object.prototype.toString.call(a) === `[object Function]`) //-------> true; console.log(Object.prototype.toString.call(a) === `[object Object]`) //-------> true; console.log(Object.prototype.toString.call(a) === `[object Null]`) //-------> true console.log(Object.prototype.toString.call(a) === `[object Undefined]`) //-------> true