var test=xxx;
alert(typeof xxx=='yyy');
注意:不管xxx是什么,yyy都要加上双引号、
var a='4399'-0;
alert(typeof a=='number');//true
var test=null;
alert(typeof test=='object');//true
var test=1.2;
alert(typeof test=='float');//flase
其它检测方法:转载自:http://www.cnblogs.com/onepixel/p/5126046.html