Standby Car — JavaScript

Write the village standby car's booking page: prototypes, generators, Proxy and observers. 18 levels, played right in the browser with nothing to install.

What the levels ask

  1. Mrs. Sari books Mobil Siaga, the village's standby car, to take Grandma Marni to her check-up. Her card is made with new Perjalanan(...) and can ringkas(), yet the card has no ringkas of its own. Complete pemilik(obj, kunci): how many levels up from the card until it meets the object that owns that property itself, or -1 when it is nowhere. Today it is asked about nama, ringkas, toString and telepon.
  2. Three years of Mobil Siaga means 300 trip cards, and all of them are loaded on the neighbourhood head's old phone. Every card needs a ringkas() that writes its time, name and destination. Fill dalam (in the constructor) and luar (below it) so every card writes its summary correctly and the phone keeps only one ringkas function for all three hundred cards.
  3. Mrs. Ratna asks for every trip to record who goes along. Mr. Firman copies yesterday's lesson: what every card uses goes on the prototype, penumpang included. Today Mrs. Sari goes with Grandma Marni, Bagas and Rara go with Mr. Tono, and Mrs. Ratna goes alone. Fill awal so each card carries only its own companions.
  4. Mr. Sastro goes to the RSUD hospital with two oxygen tanks, so his card is made from PerjalananOksigen, which inherits from Perjalanan. His summary must mention the tanks, and the other cards stay as they are. Mr. Dodi also wrote an Arrived button on the driver's phone, and after it a second driver's phone marks the same trip with the card's method. Fill bayang and tandai.
  5. Mr. Harun wants the rota board to name the night drivers one at a time: one name for each next(). After Mr. Jaya, next() must answer { value: undefined, done: true }. The board also prints them all with a spread [...giliranMalam()] and with for...of. Fill bintang and akhir.
  6. Mrs. Endang prints a three-month report from buku: the printer reads it with for (const nama of buku), and the WhatsApp message with [...buku]. buku is a plain object, and for...of refuses a plain object. Fill kunci (the method's name) and hasil so all six names come out in order from August to October.
  7. Mr. Bayu is preparing a report for the RSUD hospital: the first three trips to the RSUD in the three-year book (1,642 trips). The book lives on an old phone, and every trip read is counted. Fill hasil and tiga so the answer is the first three trips to the RSUD and the book is read only up to that third trip.
  8. Ms. Wulan pins the drivers' rota on the post office board. The rota never runs out: giliranSelamanya keeps going round from Mr. Firman to Mr. Harun to Mr. Jaya. Fill bulan so jadwalBulan(30) gives the thirty nights of November.
  9. Rara opens the morning pick-up list: the phone screen shows the trips before 12.00, then the same page writes a WhatsApp message from that list. Yesterday the screen was right, but the WhatsApp message was empty. Fill jemput so the screen and the WhatsApp message both hold all three pick-ups.
  10. Mobil Siaga's stock (petrol in litres, oxygen tanks) is changed by the drivers from their own phones, and a form field always gives text. Mr. Jaya wraps dataStok in a Proxy. Four changes come in today: petrol 15, oxygen -1, oxygen 0 (the last tank used), and petrol '12'. Fill syarat so negative numbers and text are refused, but 0 is still allowed.
  11. Patients' phone numbers are kept in Buku Siaga, and Grandma Marni wants to know who opens hers. The kontak Proxy records every read in dibaca. Today the driver's phone reads the numbers of Grandma Marni, Mr. Sastro and Mrs. Sari (who is not in the book). Fill teruskan so every read is recorded and the number still reaches the phone.
  12. Mr. Harun used the last oxygen tank last night. Mr. Firman adds a WhatsApp group message to the set trap. Today comes: petrol 18, oxygen 1, then oxygen 0. Fill simpan so all three are stored, none is reported as failed, and the WhatsApp messages record all three. Buku Siaga's code runs in strict mode.

And more, 18 levels in all.