Higher Order Functions

Find the First Usable Record

Find the First Usable Record

find is the right shape when the caller needs one record, not every record that qualifies. It returns the first matching item in array order and stops searching after that match.

That stopping behavior fits scheduling and lookup helpers where the earliest usable option is the answer. The caller should not receive an array it has to unpack.

Your task: Complete nextOpenSlot so it returns the first slot that is open and starts at or after the requested minimum start time. Return null when no slot qualifies.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Find the First Usable Record

find is the right shape when the caller needs one record, not every record that qualifies. It returns the first matching item in array order and stops searching after that match.

That stopping behavior fits scheduling and lookup helpers where the earliest usable option is the answer. The caller should not receive an array it has to unpack.

Your task: Complete nextOpenSlot so it returns the first slot that is open and starts at or after the requested minimum start time. Return null when no slot qualifies.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.