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.

Arrows functions: Deep 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.

Arrow functions & destructuring

Let’s begin with destructuring. You’re going to take an object that has a first and last name and combine them in a string. You can’t get more simple than that.

Get hands-on with 1400+ tech skills courses.