Use var, let, and const to Control Variable Scope in JavaScript

InstructorYoni Weisbrod

Share this video with your friends

Send Tweet

One of the fundamental aspects of Javascript is variable scope, and in this lesson we'll dive into how variable scope works when defining variables with var, let, or const.

The three main takeaways are:

  1. Inner scope can always read values defined in an outer parent scope.

  2. Outer scope cannot read values defined in an inner scope (except when defined with var).

  3. The var scope-bleed issue can be overcome using immediately-invoked function expressions (IIFEs).