Keep the count from before
Keep the first reading available for a later comparison.
your task
Print the count before the booking, then the count after it. Declare the first reading so it cannot be assigned again.
Booking a room increases the count by one. The report shows the new count twice. Follow countBefore through the starter to see when its value changes.
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 bookings at the start
Expected output
1
Before: 22
After: 3See the input and the code for this case
let bookings = 2;
function readCount() { return bookings; }
function bookRoom() { bookings = bookings + 1; }Not run yetNo bookings at the start
Expected output
1
Before: 02
After: 1See the input and the code for this case
let bookings = 0;
function readCount() { return bookings; }
function bookRoom() { bookings = bookings + 1; }