Learn JavaScript Variables In One Video! Learn JavaScript Variable Var, Let, and Const.
Variable Keywords:
var :
var x; //declaration
x = 10; // assignment
var y =20; // initialization
1. function scope. : you can declare variable using var anywhere in function
and access it from anywhere
2. it allows shadowing : re-declaring or re- initialization but not assignment.
var x;
x = 10;
var x =20;
3. it support hoisting. it tells the interpreter that i am here.
Let
: it defines the block. it will work in closure.
it doesnt support hoisting
it also dont support shadowing
it support declaration, assignment and initialization.
Const : it also defines block scope
it will not allow hoisting and shadowing.
it will allow declaring and assignment.
it supports only initialization.
On this page of the site you can watch the video online Learn JavaScript Variables In One Video! Learn JavaScript Variable Var, Let, and Const. with a duration of hours minute second in good quality, which was uploaded by the user Tech With Saini 18 August 2024, share the link with friends and acquaintances, this video has already been watched 89 times on youtube and it was liked by 2 viewers. Enjoy your viewing!