JavaScript has two keywords for declaring non-constant variables: var and let. While let is recommended and provides block scoping, var exists for backward compatibility and is function-scoped. The variables declared with var are hoisted and can be re-declared, while let variables are not hoisted, cannot be re-declared, and have block scope.
2 Comments
Sort: