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));
For further actions, you may consider blocking this person and/or reporting abuse
Charan Sajjanapu -
Jesse Warden -
Noureddine Belguinan -
codemee -
Top comments (2)
You can use spread operator for a lot more:
And you can use it to destruct or combine objects as well:
Thank you a lot for it brother !