+ 1

What are the advantages and disadvantages of using let vs var when declaring variables in JavaScript?

answer me please😌

5th Aug 2025, 12:03 AM
ć‚µćƒžćƒ³ć‚µć”ć‚ƒć‚“
ć‚µćƒžćƒ³ć‚µć”ć‚ƒć‚“ - avatar
5 Antwoorden
+ 1
There's no known disadvantages of using "let"
6th Aug 2025, 7:11 AM
RuntimeTerror
RuntimeTerror - avatar
0
Well, let makes a variable only able to be accessed in the block it's in, while var allows it to be used in the entire function (for ex script tags) that they are declared in
5th Aug 2025, 2:13 AM
Ashton Hively
Ashton Hively - avatar
0
Using let might feel more limiting than var, but it's the safer option. Avoid var. It's the old way. It's problematic and introduces unexpected bugs because of non-standard behavior.
5th Aug 2025, 10:13 AM
Bob_Li
Bob_Li - avatar
0
Hi
6th Aug 2025, 6:19 PM
Gopavarapu Venkata Narayana
Gopavarapu Venkata Narayana - avatar