Tip 29 Access Object Properties with Destructuring

In this tip, you’ll learn how to pull information out of objects and arrays quickly with destructuring.

In the previous tip, you learned how to create default parameters, which are a great addition to the language, but they still have one big problem: Parameters always have to be given in order. If you wanted to specify the third parameter but you didn’t care about the second, you’d still be forced to enter a value. Default parameters aren’t helpful if you want to skip a parameter.

What about situations where you need a large number of arguments for a function? What about situations where you know that the needs of a functions are likely to change? In JavaScript, most developers add ...

Get Simplifying JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.