function sum(a,b){
if(!isNaN(a) && !isNaN(b)){
var total = 0;
for(var i=0; i<=arguments.length-1; i++){
total += arguments[i];
}
}
else{
var total = "";
for(var i=0; i<=arguments.length-1; i++){
total += arguments[i];
}
}
return total;
}
console.log(sum(1,2,3,4)); //5
console.log(sum("v","f","fa","yy")); //0
var fn=(x,y)=>x*y;
console.log(fn(2,33)) ;
function getElement() {
for(var i=0; i<=arguments.length-1; i++){
console.log(arguments[i]);
}
}
getElement('你','好','世','界');
07-05
1048
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交