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));
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));