Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
JAVASCRIPT DATA / CHAPTER 02 / Learn / LESSON 07
Seventh class. After the ordinary function declaration from Foundations, we learn a shorter syntax: the arrow function.
Arrow function: const double = (n) => n * 2; Short and common in JS.
In this lesson, store it in const and call it directly. Passing it as a callback argument comes next:
const addFee = (n) => n + 5; console.log(addFee(0));
Common mistake: writing => without parentheses when there are multiple parameters; or (n) => { n * 2 } without return.
(n) => n + 5 is a short callback.
DATA STANDBY
›