Prototype: makeCounter(start = 0) returns a function (step = 1) => nextValue. start, step, and the result must be safe-integer Numbers. Throw RangeError on invalid arithmetic and keep the prior value after a failed update. Factory instances are independent.

Final: memoizeOne(fn) returns an ordinary function preserving its dynamic receiver. Cache only the last successful invocation, comparing receiver and every argument with Object.is. A thrown call must not replace that successful entry. Reuse the exact result object for a cache hit; do not stringify or deeply compare arguments.

Complete the exported stubs in exercise.mjs. The prototype and final stages have separate checks.

Shell
node main.mjs --stage prototype
node main.mjs --stage final

Use Node.js 20+ locally, or the website's browser worker. Tests are standard-library only and check the documented behavior; they do not prove performance or force garbage collection.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.