The Spread Operator and Rest Parameters

Two of my favorite new features in ES6 are the Spread Operator and Rest Parameters. These two features really allow us to create powerful operations that might have required more work, and added more confusion than needed. Let’s first take a look at Rest Parameters.

Rest Parameters

From time to time you might want to write a function that would take an unknown number of arguments. JavaScript has the ability to do this through the arguments keyword. Take a sum() function, say it takes only two numbers

Get hands-on with 1200+ tech skills courses.