+25 XP
Lesson 46

Function Scope

Local vs Global variables!

What is Scope?

Scope determines where variables can be accessed in your code!

Think of scope like rooms in a house:

Living Room (Global)

Everyone in the house can access this!

Your Bedroom (Local)

Only you can access things in your room!

Two Types of Scope:

  • Global: Available everywhere in your code
  • Local: Only available inside a function