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.

1m read timeFrom damianpawlikowski.dev
Post cover image
2 Comments

Sort: