scrimba
Learn Modern JavaScript
Use the Rest Operator with Function Parameters
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Use the Rest Operator with Function Parameters
AboutCommentsNotes
Use the Rest Operator with Function Parameters
Expand for more info
index.js
run
preview
console
const sum = (function() {
return function sum(x, y, z) {
const args = [ x, y, z ];
return args.reduce((a, b) => a + b, 0);
};
})();
console.log(sum(1, 2, 3));
Console
6
,
index.html
-1:27