Day 2: Function Expressions & Arrow Functions
Daily Objective
Section titled “Daily Objective”Master function expressions and the modern ES6 arrow function syntax (=>).
1. Arrow Functions
Section titled “1. Arrow Functions”// Traditional Declarationfunction add(a, b) { return a + b;}
// Arrow Functionconst addArrow = (a, b) => a + b; // implicit return
const square = x => x * x; // single parameter needs no parenthesesconsole.log(square(5)); // 25Daily Hands-on Practice (70%)
Section titled “Daily Hands-on Practice (70%)”- Convert 3 traditional functions into one-line arrow functions.
- Log results to verify behavior.