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.

Starter code
or press Ctrl EnterNot run yet

cases

Not run yetTwo bookings at the start

Expected output

1Before: 2
2After: 3
See 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

1Before: 0
2After: 1
See the input and the code for this case
let bookings = 0;
function readCount() { return bookings; }
function bookRoom() { bookings = bookings + 1; }