+ 1

Assignment without let

What is the difference between assigning a variable with and without "let" in javascript?

9th Mar 2021, 10:17 AM
Sai Ganesh Darni
Sai Ganesh Darni - avatar
2 ответов
+ 2
let declare block scoped variable(s) var declare function scoped variable(s) variable assigned but not declared are implicitly declared as global (var)... in non 'strict mode' (else it will throw an error)
9th Mar 2021, 10:24 AM
visph
visph - avatar
0
let & const: both are block-scoped but const can't be reassigned var: either function-scoped or globally-scoped depending on the context without any of these: globally-scoped but as vespeh said, be aware that there are differences between strict mode and "sloppy" mode
13th Mar 2021, 12:38 AM
CamelBeatsSnake
CamelBeatsSnake - avatar