***
Variables declared with `var` keyword are [hoisted and _initialized_](https://dev.to/godcrampy/the-secret-of-hoisting-in-javascript-egi) which means they are accessible in their enclosing scope even before they are declared, however their value is `undefined` before the declaration statement is reached:
```js
function checkHoisting() {
console.log(foo); // undefined
var foo = "Foo";
console.log(foo); // Foo
}
checkHoisting();
```
`let` variables are [hoisted but _not initialized_](https://stackoverflow.com/questions/31219420/are-variables-declared-with-let-or-const-hoisted) until their definition is evaluated. Accessing them before the initialization results in a `ReferenceError`. The variable is said to be in [the temporal dead zone](https://stackoverflow.com/questions/33198849/what-is-the-temporal-dead-zone) from the start of the block until the declaration statement is processed:
```js
function checkHoisting() {
console.log(foo); // ReferenceError
let foo = "Foo";
console.log(foo); // Foo
}
checkHoisting();
```
***
**References**: