typeof操作符

来源:互联网 发布:vim c语言插件 编辑:程序博客网 时间:2024/06/16 23:54

typeof操作符

返回值
- undefined
- boolean
- string
- number
- object
- function

console.log(typeof null);//object/*应该尽量在声明变量后进行初始化。*/var msg1;//var msg2;console.log(msg1);//undefinedconsole.log(msg2);//报错console.log(typeof msg1);//undefinedconsole.log(typeof msg2);//undefined
0 0
原创粉丝点击