Tip 33 Reduce Complexity with Arrow Functions

In this tip, you’ll learn how to use arrow functions to destructure arguments, return objects, and construct higher-order functions.

You explored arrow functions once in Tip 20, ​ Simplify Looping with Arrow Functions ​. It’s time to take a deeper dive.

As a reminder, arrow functions allow you to remove extraneous information, such as the function declaration, parentheses, return statements, even curly braces. Now you’re going to see how to handle a few more concepts that you’ve just learned, such as destructuring. You’ll also get an introduction to new ideas that you’ll explore further in future tips.

Let’s begin with destructuring. You’re going to take an object that has a ...

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.