var arr = new Array();
var myf = function(){};
//typeof 后面如果是 表达式,必须加()
alert("typeof 1 = " + typeof 1);//number
alert("typeof (\"1\" - 0) = " + typeof ("1"- 0));//number
alert("typeof \"1\" = " + typeof "1");//string
alert("typeof (1 + \"\") = " + typeof (1 + ""));//string
alert("typeof (1==2) = " + typeof (1==2));//boolean
alert("typeof(1==1) = " + typeof(1==1));//boolean
alert("typeof [] = " + typeof []);//object
alert("typeof null = " + typeof null);//object
alert("typeof arr = " + typeof arr);//object
alert("typeof myf = " + typeof myf);//function
alert("typeof abc = " + typeof abc);//undefined
typeof 运算符
最新推荐文章于 2015-03-31 16:13:00 发布