Prototype: sumSelected(values, predicate) visits each Number once in input order, calls predicate(value, index) once, and sums values for which it returns true. Return 0 for empty input. Stop and propagate a callback exception.
Final: groupBy(values, keyOf) calls keyOf(value, index) exactly once per item in input order and returns a Map. Group keys follow first appearance; each new group array preserves item order and the original item references. Do not mutate inputs. Stop on callback failure and do not invoke later items.
Complete the exported stubs in exercise.mjs. The prototype and final stages have separate checks.
node main.mjs --stage prototype
node main.mjs --stage finalUse 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.
Complete the starter code, then run the checks.
Results and errors will appear here.