MDN self-hosted library · e01.org
Hoisting / notebook

Hoisting

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const x = 1;
{
  console.log(x); // ReferenceError
  const x = 2;
}
js
{
  var x = 1;
}
console.log(x); // 1