All lessons

Power Tools: Arrow Functions & Array Methods

9 min · JavaScript

The shorthand JS developers reach for daily — arrow functions, map, and filter.

JavaScript · Power Tools: Arrow Functions & Array Methods0/5 cleared

Enemy 1 of 5

You've already defined functions with the function keyword. Arrow functions are a newer, shorter way to write the same idea: (params) => expression. For a single expression, the result is returned automatically — no return keyword and no curly braces needed at all, which makes short, one-off functions much less noisy to write.

Arrow functions are used constantly in modern JavaScript, especially as arguments to other functions — you'll see this immediately in .map() and .filter() below. One quirk worth knowing: arrow functions handle the this keyword differently from regular functions, which matters once you're writing methods inside classes or objects, though it rarely comes up in code this simple.

You
Binary Treant

Loading editor...

Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: 36