Multiple let for single variable

The same variable cannot be declared multiple times with let. For example, the following code will result in an error:

let a = 1; alert(a); let a = 2; alert(a);

Here are two solutions to the problem. You can just enter two different variables:

let a = 1; alert(a); let b = 2; alert(b);

But you can also declare the variable a first and then operate on it:

let a; a = 1; alert(a); a = 2; alert(a);