What is the best example to learn the ES6 spread operator (...) ?

Muhammad - Mar 21 '23 - - Dev Community

The following example taken from MDN is the best example I ever found to learn the spread operator as of 21 March 2023:-

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

const numbers = [1, 2, 3];

console.log(sum(...numbers));
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . .