日期:2014-05-16  浏览次数:20347 次

js 覆盖和重载 函数
//测试同名方法 
    function testFun() { 
        showResult('this is a function named \'testFun\' with no arguments.'); 
    }; 
    function testFun(arg) { 
        showResult('this is a function named \'testFun\' with one argument,the argument is '+arg); 
    }; 

testFun();
testFun("jQuery");

?

结论:方法重名,JS会以最后定义的函数作为函数体。当然这不包括JS中的继承中的覆盖。?