+ 1
What is difference between var and let in JS?
which one most prefer to use 1. var 2. let
3 odpowiedzi
+ 2
finally i am getting that--
=> variable name declared using var can be override but variable name declared using the let keyword doesn't allow us to override the variable name and it throws an error..
=> let is introduce in ES6.
=> var is used in 90s and let is modern approach to declare variable in JS..
+ 3
https://www.sololearn.com/discuss/763646/?ref=app
https://www.sololearn.com/discuss/1089502/?ref=app
https://www.sololearn.com/discuss/1491784/?ref=app
https://www.sololearn.com/discuss/2535583/?ref=app
https://www.sololearn.com/discuss/1911206/?ref=app
https://www.sololearn.com/discuss/2679485/?ref=app
0
Var is a global variable, while let is a temporary variable within the code block.