3.5 - Scope


  • The while or do while loop allows us repeat code while a condition is true. You can also think of it as until a condition is false.

let paused = false;

while (!paused) { // ! means "not"



// etc


Today's Lesson: 3.5 - Scope (and more about Functions)

A code file has different areas called scope. These areas are controlled with the curly braces { }. Variables declared inside those braces only exist between the braces (in that scope). Variables declared at the top of the code page are considered global and available anywhere in the code.

In-class demo on Scope will be found here.

w3schools page on Scope

Today's Task(s) / Homework

  • Complete all currently assigned work. Marks are due next Wednesday - I need everything submitted this weekend (Monday at the latest).

  • This includes the work in Unit 0