天天看點

給js function的參數設定預設值

function func(a,b){

a= arguments[0] || 10;

b= arguments[1] || 50;

}

在javascript裡,函數的所有參數都被存儲在一個叫 arguments 的實參數組裡。