Tip 33: Reduce Complexity with Arrow Functions
Explore how arrow functions can simplify JavaScript coding by reducing syntax clutter. Understand the use of parentheses with special parameters, how to return objects correctly, and the basics of higher-order functions. This lesson helps you write cleaner, more flexible functions.
We'll cover the following...
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 ...