var let const in Javascript Scope | Understanding Global Local Function Block Scope

Published: 08 September 2020
on channel: Dave Gray
17,164
653

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

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.

▶ This video is part of the JavaScript Tutorials for Beginners Playlist found here:    • Javascript Tutorials for Beginners  

✅ 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:
Scope: https://developer.mozilla.org/en-US/d...
Global Scope: https://developer.mozilla.org/en-US/d...
Local Scope: https://developer.mozilla.org/en-US/d...
Eloquent JavaScript Chapter 3:
https://eloquentjavascript.net/03_fun...

📺 More Beginner JS Videos:
freeCodeCamp:    • Learn JavaScript - Full Course for Be...  
Traversy Media:    • JavaScript Crash Course For Beginners  
The Net Ninja:    • Modern JavaScript Tutorial #1 - Intro...  

✅ Follow Me:
Twitter:   / yesdavidgray  
Reddit:   / daveoneleven  
Medium:   / davegray_86804  

#var #let #const


On this page of the site you can watch the video online var let const in Javascript Scope | Understanding Global Local Function Block Scope with a duration of hours minute second in good quality, which was uploaded by the user Dave Gray 08 September 2020, share the link with friends and acquaintances, this video has already been watched 17,164 times on youtube and it was liked by 653 viewers. Enjoy your viewing!