Arrow functions provide a handy syntax for writing JavaScript functions. Learn about how and when to use them, and about some gotchas to watch out for.

In this article, you’ll learn all about JavaScript’s arrow function syntax — including some of the gotchas you need to be aware of when leveraging arrow functions in your code. You’ll see lots of examples that illustrate how they work.

Arrow functions were introduced into JavaScript with the release of ECMAScript 2015, also known as ES6. Their concise syntax, and the way they handle the this keyword, are among the main features that have contributed to arrow functions’ considerable success among developers.

Turning a Pre-ES6 Function into an Arrow Function

You could consider functions as a sort of recipe where you store useful instructions to accomplish something you need done in your program, like performing an action or returning a value. By calling your function, you execute the steps included in your recipe, and you can do so every time you call that function without needing to rewrite the recipe again and again.

#javascript #es6

ES6 Arrow Functions: Fat and Concise Syntax in JavaScript
2.10 GEEK