Functions and Arrows
Functions are values. Arrow functions are short and keep this.
Example
function add(a, b) { return a + b; }
const mul = (a, b) => a * b;
console.log(add(2, 3), mul(2, 3), [1, 2, 3].map((x) => x * 2));Result
5 6 [ 2, 4, 6 ]
Exercise
Arrow.
const f = (x) x * 2;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.