• Theory
  • Theory

Twelfth program: “Ice cream test”

Muffin liked how you coped with the puncher store task and entrusted you with one more combat mission.

Meow! We must display the current state of the products on the store website: “in stock”, “not available”, “bestseller”.

Product data is stored in the assortmentData array. Each object represents one product and has the following properties:

  • inStock: if the value is true, the ice cream is in stock; if it is false, the ice cream is out of stock.
  • isHit: if the value is true, the ice cream is the most popular among customers.

Each product state corresponds to a special class:

  • Product in stock: good--available.
  • Unavailable product: good--unavailable.
  • Bestseller: good--hit.

Write the code as an updateCards function, which accepts an array of product data. Call it with assortmentData as the argument.

Press Hey boss, here’s your program! to call the Boss. He will check if your program is working correctly. Good luck!

  • index.html
HTML
HTML

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%