+ 1
Assignment without let
What is the difference between assigning a variable with and without "let" in javascript?
2 Antworten
+ 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)
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