O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 16. Destructuring parameters

After reading lesson 16, you will

  • Know how to destructure array parameters
  • Know how to destructure object parameters
  • Know how to simulate named parameters
  • Know how to create aliased parameters

In lesson 11 you learned about destructuring objects and arrays. These same principles can be used directly within the parameter list of a function. This makes array and object parameters easier to deal with and more self-documenting, and opens the door for useful techniques such as simulating named parameters.

Consider this

The following function takes three parameters. How would you go about making all of the parameters optional so the function could be called setting only the necessary values? For ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required