Scope
Learn about global and block level scope in JavaScript.
StartKey Concepts
Review core concepts you need to learn to master this subject
Scope
Scope
function myFunction() {
var pizzaName = "Volvo";
// Code here can use pizzaName
}
// Code here can't use pizzaName
Scope is a concept that refers to where values and functions can be accessed.
Various scopes include:
- Global scope (a value/function in the global scope can be used anywhere in the entire program)
- File or module scope (the value/function can only be accessed from within the file)
- Function scope (only visible within the function),
- Code block scope (only visible within a
{ ... }
codeblock)
Scope
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory