包含了函数调用的参数数组的Arguments 对象

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p>计算所有参数之和:</p>
<p id="demo"></p>
<script>
function sumAll() {
    var i, sum = 0;
    for(i = 0; i < arguments.length; i++) {
        sum += arguments[i];
    }
    return sum;
} 
document.getElementById("demo").innerHTML =
    sumAll(1, 123, 500, 115, 44, 88);
</script>

</body>
</html>
原文地址:https://www.cnblogs.com/halao/p/7676980.html