JavaScript: Scope
41mIntermediate2018-08-15
Authors

Emmanuel Henri
Executive with 20+ years of experience in programming and design
Course details
JavaScript scope determines how variables can be accessed throughout your code. There are two scopes: global and local. Global variables are accessible from anywhere; local variables are accessible only from within the function or block the variables are declared. Scope can be confusing, especially when factors such as hoisting and closures enter the mix. This course provides a thorough introduction to the scope options for JavaScript variables, alongside challenges that help you practice what you've learned. LinkedIn Learning instructor Emmanuel Henri helps you properly scope your variables, mitigate the effects of hoisting, and declare local variables inside non-function code such as if statements using block scope.
Learning objectives
What is variable scope?
What are closures?
Global vs. local variables
Block-scoped variables
Learning objectives
What is variable scope?
What are closures?
Global vs. local variables
Block-scoped variables
Skills covered
JavaScriptOracleProgramming LanguagesSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Learn how to properly scope your variables
- 02 - Course prerequisites
1. Introduction to Variable Scope
- 03 - Setup for this course
- 04 - What is scope in JavaScript
- 05 - What are closures
- 06 - The different types of scope
- 07 - Hoisting explained
2. Global Variables
- 08 - What are global variables
- 09 - Challenge - Define global variable
- 10 - Solution - Define global variable
3. Local Variables
- 11 - What are local variables
- 12 - Challenge - Define local variable
- 13 - Solution - Define local variable
4. Block-Scoped Variables
- 14 - What are block-scoped variables
- 15 - Explore block-scoped variables with code
- 16 - Challenge - Define let const variables
- 17 - Solution - Define let const variables
Conclusion
- 18 - Next steps
Related courses
- JavaScript Practice: Scope and Closures
- AngularJS: Scope and Digest
- JavaScript: Functions
- Advanced npm
- Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python
- SharePoint Advanced: Enhancing Functionality with JavaScript
- JavaScript: Maps and Sets
- Learning TensorFlow with JavaScript