0
What are the advantages and disadvantages of using let vs var when declaring variables in JavaScript?
answer me please😌
3 odpowiedzi
+ 3
サマンサちゃん
Consider using search bar before posting a question:
https://www.sololearn.com/discuss/840637/?ref=app
https://www.sololearn.com/discuss/3332369/?ref=app
https://www.sololearn.com/discuss/3279959/?ref=app
https://www.sololearn.com/discuss/763646/?ref=app
https://www.sololearn.com/discuss/1518384/?ref=app
https://www.sololearn.com/discuss/3041287/?ref=app
https://www.sololearn.com/discuss/2535583/?ref=app
https://www.sololearn.com/discuss/2764515/?ref=app
https://www.sololearn.com/discuss/1491784/?ref=app
https://www.sololearn.com/discuss/1089502/?ref=app
https://www.sololearn.com/discuss/2930947/?ref=app
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
0
using let might feel more limiting than var, but it's the safer option.