Let is used to declare variables that whose value can be changed later.
Explanation:
-
The value of 'score' is updated from 50 to 80
-
'let 'allows reassignment but not redeclaration in the same scope
Key Features of 'let'
-
Block-scoped: Variables declared with let can only be accessed inside the '{}' within which the variable is declared.
-
Cannot be redeclared in the same block
Preferred for most variables