typeof操作符
返回值
- undefined
- boolean
- string
- number
- object
- function
console.log(typeof null);//object
/*應該儘量在聲明變量後進行初始化。*/
var msg1;
//var msg2;
console.log(msg1);//undefined
console.log(msg2);//報錯
console.log(typeof msg1);//undefined
console.log(typeof msg2);//undefined