//三个数相加
function sum(num1 + num2 + num3) {
return num1 + num2 + num3
}
// 传入多个数值
function sum(...num) {
console.log(num);
var nums = 0;
for (var i=0; i< arguments.length; i++) {
if (isNaN(arguments[i])) continue;
nums += parseInt(arguments[i]);
console.log(nums);
}
return nums;
}
sum(10,30,36,50,64,256,618,1024)
function sum(...num) {
console.log(num);
}
sum(10,30,36,50,64,256,618,1024)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)