257350
判断一个变量里存的 是否为基本数据类型
All primitive types, except null, can be tested by the typeof operator. typeof null returns "object", so one has to use === null to test for null.
那么可不可以这样:
function isPrimative(target) {
return typeof target != 'object' && typeof target != 'function' || target === null
}
大家有没有想到什么反例,或更简洁的方式,感谢指导!