filmov
tv
var let const in Javascript Scope | Understanding Global Local Function Block Scope
Показать описание
In this video we'll compare the keywords var, let, and const in JavaScript which also requires an understanding of JavaScript scopes such as global scope, local scope, function scope, and block scope.
✅ Quick Concepts outline:
var, let, and const in Javascript
(00:00) Intro
(0:30) What makes var different
(1:40) What makes let different
(2:05) What makes const different
(2:35) A discussion of scope
(2:50) Global Scope
(3:25) Local Scope
(3:35) Block Scope
(4:00) Function Scope
(4:45) Local Scope variables declared with let or const are not available in global scope
(6:00) Nested block scope inside of a function
(7:05) Global scope variables are available in local scopes
(8:00) Global scope is available to all scopes
(8:25) If statements have block scopes
(8:35) for loops have block scopes
(8:45) switch statements have block scopes
(9:00) Review of scopes so far...
(9:50) A 2nd Example of global, function, and block scopes
(14:40) Note: var is function scoped; const & let are block scoped
(15:45) Review with helpful graphic :)
📚 Further Reading:
MDN Web Docs:
Eloquent JavaScript Chapter 3:
📺 More Beginner JS Videos:
✅ Follow Me:
#var #let #const
Комментарии