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.
Auf dieser Seite können Sie das Online-Video Learn JavaScript Variables In One Video! Learn JavaScript Variable Var, Let, and Const. mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Tech With Saini 18 August 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 89 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!