REST - fluorescent Neon tube Sign on brickwork - Front view - 3D rendered royalty free stock picture. Can be used for online banner ads and direct mailers.


Rest allows a function store multiple objects in a single array. Here is an example…

function animals(…animals) {
    animalIds.forEach(animal => console.log(animal)); 
animals(‘gorilla’, ‘koala’, ‘elephant’); 

When run, the console would output ‘gorilla’, ‘koala’, ‘elephant’ to the console.

Note: that rest parameters must be the last parameter in the function. This is why it is called “rest”…it is the rest of the parameters.

Happy Coding!

Clay Hess

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email
Skip to content