An empty list: pass or fail
Decide what an empty result means for each check.
your task
Pass the room check only when it finds rooms and every room is free. Pass the warning check when every warning was seen, including when there are none. Print the rooms result first, then the warnings result.
The desk has free rooms, so an empty search result is a failure. The desk can also have no warnings. The starter gives the wrong result for both empty lists.
Run code runs your code once for each case. It compares what your code prints with the expected output.
Starter code
or press Ctrl EnterNot run yet
cases
Not run yetTwo free rooms, no warnings
Expected output
1
rooms: pass2
warnings: passSee the input and the code for this case
const rooms = [{ name: "Atlas", free: true }, { name: "Birch", free: true }];
const warnings = [];Not run yetNo rooms, one seen warning
Expected output
1
rooms: fail2
warnings: passSee the input and the code for this case
const rooms = [];
const warnings = [{ text: "Lift out of order", seen: true }];Not run yetOne taken room, one unseen warning
Expected output
1
rooms: fail2
warnings: failSee the input and the code for this case
const rooms = [{ name: "Atlas", free: true }, { name: "Cedar", free: false }];
const warnings = [{ text: "Lift out of order", seen: true }, { text: "Fire drill at 10:00", seen: false }];