javascript中typeof的使用
<script> <BR>//1、基本型別<BR>var x = 123; <BR>var y = "abc"; <BR>var z = true; <BR>//alert(typeof x);//number <BR>//alert(typeof y);//string <BR>//alert(typeof z);//boolean <BR>//2、引用型,型別是object <BR>var arr = new Array(); <BR>var date = new Date(); <BR>var str = new String("abc"); <BR>//alert(typeof arr );//object <BR>//alert(typeof date);//object <BR>//alert(typeof str);//object <BR>//3、物件類型,可以理解為javascript中的類的模擬是透過function來實現的<BR>alert(typeof Array);//function <BR>alert(typeof Date);//function <BR>alert(typeof String);//function <BR></script>