Same object or same content
A copied booking can have the same details as the original.
your task
For “selection kept”, check whether selected and picked are the same object. For “server copy matches”, check the room and hours. Print the two results in that order.
The desk should keep the booking object the user selected. The server always returns a separate object. The starter accepts a copied selection and rejects server data that matches.
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 yetOriginal selection, matching server data
Expected output
1
selection kept: true2
server copy matches: trueSee the input and the code for this case
function sameContent(a, b) {
return a.room === b.room && a.hours === b.hours;
}
const picked = { room: "Atlas", hours: 2 };
const selected = picked;
const fromServer = { room: "Atlas", hours: 2 };Not run yetCopied selection, different server hours
Expected output
1
selection kept: false2
server copy matches: falseSee the input and the code for this case
function sameContent(a, b) {
return a.room === b.room && a.hours === b.hours;
}
const picked = { room: "Atlas", hours: 2 };
const selected = { room: "Atlas", hours: 2 };
const fromServer = { room: "Atlas", hours: 3 };