Episode 3: Variable Scope In JavaScript


Watch The Free Preview For “Variable Scope In JavaScript”


Subscribe now to watch the full episode!

Get Instant Access To All Episodes »


Are you staring a pile of JavaScript, wondering why anyone would use that pesky “var” keyword? Or perhaps your looking at a series of nested functions that seem to share variables, but you can’t figure out how. And why is that function wrapped in parenthesis, with a bunch of vars in it?

In this episode, you’ll see:

  • Global vs function scope
  • Variable hoisting
  • Nested functions and closures
  • Immediate functions
  • JavaScript modules
  • Object literals
  • Constructor functions
  • Private and shared variables

Join me as I explore and explain the basics of managing the scope of variables in JavaScript. We’ll work with with global and local variables, immediate functions, JavaScript modules, constructor functions, objects instances, and more. Along the way, we’ll also look at a number of common JavaScript patterns that help us take advantage of scoping.