在这两段代码中为什么用return才能实现?用alert却不能呢?
/* function sum_num(){
var total = 0;
for(var i=0;i<arguments .length;i++){
total+=arguments[i];
}
return total;
}
alert(sum_num(2,34,45,56,56)); */
function sum_num(){
var total = 0;
for(var i=0;i<arguments .length;i++){
total+=arguments[i];
}
alert(sum_num(total));
}
sum_num();
求大神解答呀?
虚弱的西瓜瓜
11 years, 8 months ago