When we write code like bellow snippet JavaScript don't compile this code and return *Uncaught SyntaxError: Identifier 'variableName' has already been declared* and we don't see "Hello World" in console

```js
function functionName() {
  console.log("Hello World");
}

functionName();
let variableName = "Murad";
let variableName = "Tofiq";
```

But when we write code like bellow snippet, code is compiled but return error in execution time and we see "Hello World" in console.

```js
function functionName() {
  console.log("Hello World");
}

functionName();
console.log(variableName);
let variableName = "Tofiq";
```

My question is JavaScript compiler know semantic analysis time we declare variable with let this is create TDZ(temproary dead zone) and this code return error. But why this code compile? Is this bug?