0

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
3 Respostas
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.
5th Aug 2025, 10:13 AM
Bob_Li
Bob_Li - avatar