JS Let

Using let

Declare block-scoped variables using let, e.g., let x = 10;.

When to Use let

Use let when a variable's value needs to change over time within its block scope.

Practical Examples

for (let i = 0; i < 5; i++) {
  console.log(i);
}