typeof

来源:互联网 发布:如何测试端口通不通 编辑:程序博客网 时间:2024/05/14 08:55

1、基本类型,数字Number,布尔Boolean,字符串String,undefied,

typeof 1;//numbertypeof true;//booleantypeof "";//stringtypeof zheng;//undefined

2、引用类型,{},null,

typeof {};//objecttypeof null;//objecttypeof Math;//objecttypeof /zheng/gi;//object

3、函数对象

typeof Number;//functiontypeof Boolean;//functiontypeof String;//functiontypeof RegExp;//functiontypeof Date;//functiontypeof Error;//functiontypeof Function;//functionvar sayName = function{alert(this.name)};typeof sayName;//function
原创粉丝点击