MDN self-hosted library · e01.org
Magic comments / notebook

Magic comments

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

js
//# allFunctionsCalledOnLoad
js
//# allFunctionsCalledOnLoad
function init() {
  console.log("init");
}

init();
js
//# sourceURL=<url>
js
eval(
  'console.log("Hello"); throw new Error("error");\n//# sourceURL=generated-code.js',
);
js
//# sourceMappingURL=<url>
js
function createPoint(x, y) {
  return { x, y };
}

const point = /*#__PURE__*/ createPoint(1, 2);
js
// -- Compiler output --
function createPoint(x, y) {
  return { x, y };
}

createPoint(1, 2);
js
/*#__PURE__*/ createPoint(1, getY());
js
/*#__PURE__*/ createPoint(1, /*#__PURE__*/ getY());
js
/*#__NO_SIDE_EFFECTS__*/
function createPoint(x, y) {
  return { x, y };
}
js
const record = { _internalValue: 42 };
Object.getOwnPropertyDescriptor(record, /*@__KEY__*/ "_internalValue");
js
import { jsx as _jsx } from "preact/jsx-runtime";

const heading = _jsx("h1", {
  children: "Hello",
});
js
var supportsConditionalCompilation = false;
/*@cc_on
  supportsConditionalCompilation = true;
@*/