Module 4 · Lesson 2 of 414/32 in the course~16 min
Module lessons (2/4)
Arrow function
Lesson preview5 hands-on exercises readyJavaScript Course · Module 4 — Functions
Compact => syntax, concise body vs block, implicit return.
What you'll learn in this lesson
- Write concise arrow function (
(x) => expr) with implicit return and multi-statement bodies with braces +return. - Avoid the syntax error of implicitly returning an object (
() => ({ ok: true })). - Recognize when parentheses are needed for zero or two+ parameters.
- Understand why arrow functions inherit
thislexically from the surrounding scope.
Overview
The arrow functions (=>) introduced by ES6 have become the standard for short callbacks, array pipelines (.map, .filter, .reduce), and asynchronous handlers. They offer a streamlined syntax and do not create their own dynamic this.
Sections covered in this lesson
- 1Mental model: syntax and implicit return
- 2Progressive examples
- 3Guided laboratory
- 4Check for understanding
Pro Lesson · Module 4 — Functions
Unlock "Arrow function" and the full JavaScript Course curriculum
Compact `=>` syntax, concise body vs block, implicit return.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in JavaScript Course plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.