typeof 用来判断给定变量的六种数据类型(String、Number、Object、Boolean、Undefined、Function)
eg:
var str = 'abc';
var arr = ['a','b','c'];
console.log(typeof 12345);//number(数值)
console.log(typeof true);//boolean(布尔值)
console.log(typeof sum());//function(函数)
console.log(typeof str);//string(字符串)
console.log(typeof arr);//object(对象)
console.log(typeof undefined);//undefined(undefined)
console.log(typeof NaN);//number
啦啦啦~~第一次写请多指教