From the course: Learning the JavaScript Language

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Jargon: Scope in JavaScript

Jargon: Scope in JavaScript

- [Instructor] It's time for a brief digression to deal with a little jargon you might hear about. JavaScript is super popular and draws a lot of attention from developers of many skill and experience levels. So knowing where some jargon comes from can help you with possibly boring parties. Here, we're going to talk about scope. Scope refers to where variables are defined and what parts of our code can access the variables that we define. Often when we talk about scope, we differentiate between global scope and local scope. Global refers to variables that are defined in such a way that they are accessible anywhere. Local means that a variable is accessible in a way that's more limited, perhaps only inside a particular function. One piece of guidance almost every beginning programmer gets is to avoid creating global variables. Global variables are accessible everywhere, which is very convenient, but the global name space as…

Contents