DEV Community

Discussion on: Rest vs Spread Operator

Collapse
 
hacker4world profile image
hacker4world

Great article but you did not give an example on functions
Heres what the example would be:

function logParams(...params) {
     console.log(...params);
}

logParams(1,  2,  3, 4);
Enter fullscreen mode Exit fullscreen mode

Now the function can take an infinite amount of params and it puts them in the array

Collapse
 
melguachun profile image
Melissa Guachun

Thank you for pointing that out!! I'll add a note and tag you and the article if you don't mind!

Collapse
 
hacker4world profile image
hacker4world

Ok good