![]() ![]() When using let, I need to make sure I am declaring the variable in the correct block that I intend to use it. So the placement of var must not be as big of a deal because if I’m in the scope, I’m good. Since the scope is var is local, “regardless of block scope”, it will be scoped to the entire function. This is unlike the `var` keyword, which defines a variable globally, or locally to an entire function regardless of block scope.īased on this definition, let seems to have a more limited or defined scope than var. `let` allows you to declare variables that are limited in scope to the block, statement, or expression on which it is used.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |