ES6 Tutorial #2: var, let and const | Variable Scope | Modern Javascript 2021

Опубликовано: 19 Январь 2025
на канале: Nisha Singla
12,733
315

ES6 Tutorial #2: var, let and const | Variable Scope | Modern Javascript 2021.


let and const are 2 keywords that are added in ES6 to declare variables.
In ES5 var keyword is used but some issue are attached with var because only function can create a scope when we use var, anything inside function is private and anything outside function is global and block don't create scope in ES5 which leads to issue because sometime data may override our variable.
So to control the accessibility of our data ES6 introduced let and const which allow you to create block scope.
Now in ES6 unlike ES5 we can't redeclare a variable with same name and we can't use the variable before declaring it.

On other hand const are similar to let , the only difference is const are used to create read only values, which can't change.

There is one practice question at time , so take a look and comment me your answer.

I hope you have liked this video. For such more video like and subscribe my
channel

Mic used in my videos: https://amzn.to/3nqYF5A

Subscribe to my channel :    / nishasingla  


If you want to learn Angular then
Watch complete playlist here:    • Introduction- Angular (Tutorial #1)  

Follow us on:

Facebook:   / angularjs4beginners  
LinkedIn:   / nisha-singla-82407aa0  
Website :
Instagram:  / passion4code  

For more such interesting videos, please subscribe to our channel and stay connected.

#letConst​ #ModernJavaScript #NishaSingla