类是function。对象是object。 <script type="text/javascript">
//<![CDATA[
var o = { m: 'never-online' }
alert(typeof(o)) //对象。
try {
var b = new o;
alert(b.m);
} catch(ex) { alert(ex.message) } function myClass() { this.m = 'never-online'; }
alert(typeof(myClass)) var a = new myClass(); //是myClass的一个实例对象
alert(a.constructor);
alert(typeof(a));
//]]>
</script>
//<![CDATA[
var o = { m: 'never-online' }
alert(typeof(o)) //对象。
try {
var b = new o;
alert(b.m);
} catch(ex) { alert(ex.message) } function myClass() { this.m = 'never-online'; }
alert(typeof(myClass)) var a = new myClass(); //是myClass的一个实例对象
alert(a.constructor);
alert(typeof(a));
//]]>
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货