BuildBot

JavaScript, Refreshed

Functions, scope & closures

Lesson 2 of 5

Functions are values, and they remember the scope they were born in.

What you'll learn

  • Treat functions as first-class values you can pass and return
  • Reason about lexical scope — where a variable is visible
  • Use a closure to keep private state alive between calls
Members only

A free account unlocks this lesson and every other one.

Runnable challenges, knowledge checks, and progress that syncs across your devices. No card needed.

Not sure yet? Try the free lesson first: Values, types & coercion