typeof操作符

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章