First and last booking
Find the first and last items in an array of any nonzero length.
your task
Keep the count line. Fix the two guest lines. In a one-row table, both must show the same guest.
In the three-row case, the count is correct. The “first” line shows Jonas, and the “last” line shows undefined. The names in guests follow table order.
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 yetThree rows
Expected output
1
count: 32
first: Mira3
last: ToveSee the input and the code for this case
const guests = ["Mira", "Jonas", "Tove"];
Not run yetOne row
Expected output
1
count: 12
first: Anouk3
last: AnoukSee the input and the code for this case
const guests = ["Anouk"];