Prototype: availableCopies(copies,title) takes valid [copyId,title,availableBoolean] tuples and returns a fresh sorted list of free exact-title IDs without mutation. Unknown title gives [].
Final: new Library(copies) copies [copyId,title] pairs; IDs unique nonempty, titles/member IDs nonempty. borrow(memberId,title) chooses smallest free copy ID or null; duplicate member/title raises even if exhausted. returnCopy(copyId,memberId) releases the owner's loan (true), returns false if unloaned/unknown, raises RangeError for wrong owner. available(title) is a fresh sorted ID list. loans() returns fresh {copyId,title,memberId} objects sorted by copy ID. Empty catalog valid; no due dates/editing.
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.