返回类型的字符串,比如:
console.log(typeof 100) 输出“number“
console.log(typeof 'aaa') 输出“string“
console.log(typeof false) 输出"boolean"
console.log(typeof null) 输出是“object”
console.log(typeof undefined) 输出“undefined”
console.log(typeof Symbol) 输出“function”
console.log(typeof {a:1}) 输出“object”
function fun1(){
var a;
a++
return a
}
console.log(typeof fun1)
输出“function”
function fun1(){
var a;
a++
return a
}
var obj1 = new fun1()
console.log(typeof obj1)
上面输出“object“