Lesson 11 of 18

🔃 Functions & Scope

🎯 Grades 9–12 ⏱ ~35 minutes 🟡 Intermediate

What You'll Learn

  • Function declarations, expressions, and arrow functions
  • Parameters, return values, and default arguments
  • Block scope, closure, and the call stack
Quick Check

1. Which syntax is a valid arrow function?

Afunction (x) => x * 2
Bconst double = x => x * 2;
Cdef double(x): return x * 2

2. What does a function return if there is no return statement?

A0
Bundefined
Cnull

3. Block scope means…

AVariables declared with let/const inside {} are only accessible within those braces
BVariables are accessible everywhere in the file
CVariables declared with var cannot be changed

4. What is a default parameter?

AA parameter that is always required
BA fallback value used when no argument is passed for that parameter
CThe first parameter of every function