Block-scoped: Variables declared with let are block-scoped, which means they are accessible only within the nearest pair of curly braces {} where they are defined.
Hoisted: Like var, let declarations are hoisted to the top of their containing block, but unlike var, they are not initialised until the actual declaration is encountered in the code.
They Suffer from the temporal dead zone
Accessing them before their declaration will return a reference error.
Mutable: Variables declared with let can be reassigned within their scope, but they cannot be redeclared in the same scope.
Block-scoped: Like let, variables declared with const are block-scoped.
Hoisted: Similar to let, const declarations are hoisted to the top of their containing block but are not initialized until the declaration is encountered.
Immutable (sort of): Variables declared with const cannot be reassigned after their initial value assignment. However, if the variable holds a reference to an object, the properties of that object can be mutated.
In modern JavaScript development, it's generally recommended to use const by default and only use let when you need to reassign a variable's value within the same block scope.
This helps prevent unintended variable mutations and leads to more predictable code.
Use var sparingly, if at all, because of its global or function-scoped behaviour and potential issues with hoisting.