You don't need to define any parameters for a function.(您无需为函数定义任何参数。)
You can just use the function's arguments
array-like object.(你可以使用函数的arguments
类似数组的对象。)
function sum() {
var retval = 0;
for (var i = 0, len = arguments.length; i < len; ++i) {
retval += arguments[i];
}
return retval;
}
sum(1, 2, 3) // returns 6
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…