filmov
tv
Variable Declaration ( Var - Let - Const ) | Javascript Learning #javascript
Показать описание
The var keyword is the oldest way of declaring variables in JavaScript and is supported by all browsers. The let and const keywords are newer additions to the language and are not supported by older browsers.
If you need to support older browsers, you can use var instead of let or const. If you don’t need to support older browsers, you can use let or const. If you want your variable to be immutable, use const.
So, to sum up, the main differences between var, let and const are:
1) var is function-scoped while let and const are block-scoped.
2) var variables can be reassigned while let and const variables can not.
3) var variables are declared using the var keyword while let and const variables are declared using the let and const keywords respectively.
4) const variables are immutable while let and var variables are not.
javascript variable declaration,javascript,javascript variables,javascript variables tutorial,javascript for beginners,ECMAScript,variables in javascript,javascript tutorial for beginners,es6,javascript variables explained,javascript programming,let vs const,var vs let,javascript var,var vs const,front end,web development,javascript variable types,let vs var vs const,var let const,javascript let,const,programming
If you need to support older browsers, you can use var instead of let or const. If you don’t need to support older browsers, you can use let or const. If you want your variable to be immutable, use const.
So, to sum up, the main differences between var, let and const are:
1) var is function-scoped while let and const are block-scoped.
2) var variables can be reassigned while let and const variables can not.
3) var variables are declared using the var keyword while let and const variables are declared using the let and const keywords respectively.
4) const variables are immutable while let and var variables are not.
javascript variable declaration,javascript,javascript variables,javascript variables tutorial,javascript for beginners,ECMAScript,variables in javascript,javascript tutorial for beginners,es6,javascript variables explained,javascript programming,let vs const,var vs let,javascript var,var vs const,front end,web development,javascript variable types,let vs var vs const,var let const,javascript let,const,programming
Комментарии