实现 js 数据类型的判断函数type时间:2023-03-10 05:21:37 type = (obj) => { const pass1 = typeof obj if (pass1 != 'object') return pass1 const pass2 = obj == null ? 'null' : Object.getPrototypeOf(obj).constructor.name.toLowerCase() return pass2 } console.log(type({"a":"111",a:[1,2,3]}))//自己 测试了下ok的!0.0