JavaScript typeof 和instanceof的区别
in Web前端 on javascript web 前端 - Hits()
JavaScript typeof 和instanceof的区别
a instanceof b
a必须是一个b类实例才会返回true
如果a是个原始类型则会是false
"ss" instanceof String //false
而typeof只会返回"number," "string," "boolean," "object," "function," 和 "undefined"