📜  休息运算符(...args) - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:04.038000             🧑  作者: Mango

代码示例1
function sum(...args) {
    let total = 0;
    for (const a of args) {
        total += a;
    }
    return total;
}

sum(1, 2, 3);Code language: JavaScript (javascript)