Scope

JavaScript variables can be scoped globally or locally to a function or block. Making sure that you correctly handle scope reduces the risk of unexpected side effects and bugs. The scope of the variable declaration determines the execution context of the variable; the ability to access a variable is determined by the execution context.

Contact Us or call 1-877-932-8228
Lesson Goals
  • Learn about the scope of a variable.
  • Recognize how the var keyword affects scope./li>
  • Use the ES2015 let keyword to control the scope of a variable.
  • Use the ES2015 const keyword to control the scope and immutable binding of a variable.