Prototype: touchOrder(keys,key) takes distinct nonempty keys and returns a new oldest-to-newest list with key once at end. Preserve input; no capacity limit.
Final: new LRUCache(capacity) requires nonnegative safe integer. Keys nonempty; values any safe integer (negative allowed). put inserts/updates, refreshes, evicts oldest if needed, and returns undefined. At zero capacity valid put does nothing. get(key,fallback=null) returns hit value and refreshes, or exact fallback identity without order change. delete removes once and returns bool. items() returns fresh [key,value] pairs least-recent first. Invalid data changes no value/order.
Every class is exported by name from exercise.mjs. Keep instances independent. Unless explicitly documented otherwise, input values have the stated collection/string types and do not contain null elements. Invalid calls preserve state; validate before mutation. Return fresh mutable snapshots unless stated otherwise.
Complete the starter code, then run the checks.
Results and errors will appear here.