const x = 1;
{
console.log(x); // ReferenceError
const x = 2;
}Hoisting / notebook
Hoisting
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
{
var x = 1;
}
console.log(x); // 1