What is the difference between var and let ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between var and let ?

In javascript it simply defines var=(variable),so what is the "let",and the output between those two are not equal when take together... So please explain me what it is,and what is the difference between those two and most probably where to use them commonly..🤔. 😇🙂😇

28th Jan 2021, 4:33 AM
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ - avatar
2 Answers
0
In simple words , any variable declared using var keyword can be used anywhere in the program. And any variable declared using let keyword could be accessed/used/modified only within the scope in which it is declared ....
28th Jan 2021, 5:30 AM
Alphin K Sajan
Alphin K Sajan - avatar