Skip to content

Lesson 02 · JavaScript

JavaScript Foundations: Functions & Control Flow

Reusable logic in JavaScript: function declarations, expressions and arrows, return values, branching with if/else and switch, looping with for and for..of, and guard clauses.

Prerequisites: JavaScript Foundations: Values, Variables & Types

Learning objectives
By the end of this lesson, you will be able to:
  • Write function declarations, function expressions, and arrow functions
  • Distinguish return values from side effects
  • Branch with if/else and switch
  • Loop with for and for..of
  • Use early-return guard clauses to keep functions flat