帮我看看这两个有什么不同 var a = new abc(); a.method() 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼上的这个我当然知道,但为什么 Function不用生成一个对象就能调用method呢 "number"、"string"、"boolean"、"object"、"function"、 "undefined" 6种内部类型 一般不需要new Number.prototype.method=function(){alert(1);} Number.method();也不能执行 啊 我语文不好 用下面代码意会~~第一步运行下面的代码第二步注释掉Function.pro……或Object.pro…… 运行看效果第三步注释掉Function.pro……和Object.pro…… 运行看效果<SCRIPT LANGUAGE="JavaScript">Function.prototype.method=function(){alert("Function");}Object.prototype.method=function(){alert("Object");}//Boolean.prototype.method=function(){alert("Boolean");}String.prototype.method=function(){alert("String");}Number.prototype.method=function(){alert("Number");}var aaa = "aaa";aaa.method();var bbb = 123;bbb.method();true.method();//false.method();try{ Number.method();}catch (exception){ alert(exception);}try{ String.method();}catch (exception){ alert(exception);}try{ Boolean.method();}catch (exception){ alert(exception);}try{ Object.method();}catch (exception){ alert(exception);}try{ Function.method();}catch (exception){ alert(exception);}</SCRIPT> javascript 字符串替换 jHtmlArea 0.7.0代码解读 菜鸟问通过id设置背景颜色 jquery facebox.js插件获取不到弹出层的值 请高手解决JS的先随机,后固定问题 js限制textbox输入 树状列表在本机调试的时候,显示不正常;用IE浏览的时候却正常.怎么回事啊? 怎么能在页面上动态的画一条斜线?请指点。 JavaScript函数调用的问题 求chrome和opera不支持parent.document.documentElement.clientHeight解决方法 请问关于得到showModalDialog对象的问题 JS高手帮忙啊!!!!!
6种内部类型 一般不需要new
Number.method();也不能执行 啊
第一步运行下面的代码
第二步注释掉Function.pro……或Object.pro…… 运行看效果
第三步注释掉Function.pro……和Object.pro…… 运行看效果<SCRIPT LANGUAGE="JavaScript">
Function.prototype.method=function(){alert("Function");}
Object.prototype.method=function(){alert("Object");}
//
Boolean.prototype.method=function(){alert("Boolean");}
String.prototype.method=function(){alert("String");}
Number.prototype.method=function(){alert("Number");}var aaa = "aaa";
aaa.method();
var bbb = 123;
bbb.method();
true.method();//false.method();
try
{
Number.method();
}
catch (exception)
{
alert(exception);
}
try
{
String.method();
}
catch (exception)
{
alert(exception);
}
try
{
Boolean.method();
}
catch (exception)
{
alert(exception);
}
try
{
Object.method();
}
catch (exception)
{
alert(exception);
}
try
{
Function.method();
}
catch (exception)
{
alert(exception);
}
</SCRIPT>