+ 1

What is difference between var and let in JS?

which one most prefer to use 1. var 2. let

24th Apr 2021, 2:25 AM
æshrîth.htm
æshrîth.htm - avatar
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..
25th Apr 2021, 12:23 AM
æshrîth.htm
æshrîth.htm - avatar
0
Var is a global variable, while let is a temporary variable within the code block.
24th Apr 2021, 4:57 AM
Anthony Johnson
Anthony Johnson - avatar