JS

runtime.js

One spine: the evolution of JavaScript

Pick an era, expand a concept, and see where it lands in today's runtimes. Every snippet can be dropped straight into the sandboxed console — the event loop panel then shows real, instrumented execution, not a looping animation.

ES6 / 2015

ES20152015

The largest single revision of the language. Block scoping, lexical `this`, class syntax, and a standardised Promise — the foundation of every later feature.

Class syntax is sugar over prototypes, but with real rules: methods are non-enumerable, constructors require `new`, and class bodies are always strict. `extends` wires up `super` and `instanceof` across the whole chain.

class Animal {
  constructor(name) {
    this.name = name;
  }
  speak() {
    return this.name + " makes a sound";
  }
}

class Dog extends Animal {
  constructor(name) {
    super(name);
    this.species = "dog";
  }
  speak() {
    return this.name + " barks";
  }
}

const rex = new Dog("Rex");
console.log(rex.speak());
console.log("instanceof Dog / Animal:", rex instanceof Dog, rex instanceof Animal);
console.log("static chain:", Object.getPrototypeOf(Dog) === Animal);
console.log("own enumerable keys:", Object.keys(rex)); // instance fields only
Private fields (#) across runtimes
V8`#x` is enforced at parse time and invisible to `Object.keys` and `getOwnPropertyNames` — true privacy, not a naming convention. Shipped in V8 7.4 (2019).
Node.jsPrivate fields landed in Node 12 (V8 7.4); the ergonomic `#x in obj` membership check since Node 16.
DenoFull `#` support, including `#x in obj`, from the very first 1.0 release — it launched after the feature was already standard.
BunJavaScriptCore implements private fields natively, with semantics that match V8 exactly.

Interview gotchas

15 genuinely tricky, well-known snippets — event-loop ordering, closures in loops, and `this`-binding traps. Open one, read the gotcha, then drop it straight into the sandboxed console to watch it really run.

Event loop
Closures & scope
this binding
Promises & async
Coercion & equality
Built-in traps