var a = new abc(); 
a.method()

解决方案 »

  1.   

    楼上的这个我当然知道,但为什么 Function不用生成一个对象就能调用method呢
      

  2.   

    "number"、"string"、"boolean"、"object"、"function"、 "undefined" 
    6种内部类型 一般不需要new
      

  3.   

    Number.prototype.method=function(){alert(1);}
        
    Number.method();也不能执行 啊
      

  4.   

    我语文不好 用下面代码意会~~
    第一步运行下面的代码
    第二步注释掉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>