javascript

Javascript ES6 Rest Parameters

function sum(x, y, z) {
  return x + y + z;
}

const numbers = [1, 2, 3];

console.log(sum(...numbers));
Output
6
Was this helpful?