This is in contrast with most programming languages like Java or C in which the scope of the variable is block (the closest curly braces pair
This behavior applies for
for loop as well:
const, which will scoped within the block.
const behaves like
let, but it cannot be reassigned.
const by default, and switch to
let when they need to reassign the variable. Very few developer use
const cannot be reassigned doesn't mean it cannot be changed. If the variable is not a primitive value, i.e.
number, it could be modified.