Skip to content

Day 2: Function Expressions & Arrow Functions

Master function expressions and the modern ES6 arrow function syntax (=>).

// Traditional Declaration
function add(a, b) {
return a + b;
}
// Arrow Function
const addArrow = (a, b) => a + b; // implicit return
const square = x => x * x; // single parameter needs no parentheses
console.log(square(5)); // 25
  1. Convert 3 traditional functions into one-line arrow functions.
  2. Log results to verify behavior.