JS数据类型检测typeof、instanceof、constructor、Object.prototype.toString.call(val)的区别

数据类型检测的四种方式 typeof 不能细分对象类型的值,都是返回“object”,函数检测返回“function”。 typeof 10:number typeof new Number(10):object typeof true:boolean typeof new Boolean(true):object typeof “aaa”:string typeof new String(“aa
相关文章
相关标签/搜索