07.30《JavaScript》——JS中的函数没有重载的概念

JS中的函数没有重载的概念

 js中不像是java,拥有重载的概念,所以函数名相同的函数,js会认为是同一个函数,所以会输出写在最后的一个函数的结果。

function test(){
                alert(arguments[0]);
            }
function test(x){
                alert(x)
            }
function test(x,y){
                alert(x+"  "+y)
            }
            
test(7);

结果是:

 

posted @ 2018-07-30 23:21  微光TeaRs  阅读(458)  评论(0)    收藏  举报