Settings contain exactly the keys retries and timeoutMs. retries is a nonnegative safe-integer Number; timeoutMs is a positive safe-integer Number.

Prototype: parseSettings(json) parses a JSON string, requires a non-null non-array object with exactly those two own keys, validates values, and returns a fresh {retries, timeoutMs} object. JSON syntax errors remain SyntaxError; shape/domain errors throw RangeError.

Final: mergeSettings(defaults, overrides) validates defaults as a complete settings object and overrides as a non-null non-array object containing any subset of the two keys. Reject unknown own keys, including prototype-related names, and invalid values with RangeError. Return a fresh complete object; preserve both inputs. No recursive merge or coercion.

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.