Interactive online courses HTML Academy
2026-03-09 12:56 Diff

All we have left to do is process the last two properties from the upload: isSpecial and specialPrice. The isSpecial property contains true if the product is covered by the special offer. The special-offer product gets a new price, which is stored in specialPrice.

You have already solved a similar task: special-offer cards should get an additional class product--special. But now you also need to show a special price. It should be in a paragraph with class product__special-price. This paragraph should be the last child element in the card.

The order of actions is as follows:

  1. check whether the product is covered by special offer;
  2. if the check goes through, add a class to the product card,
  3. and also add another paragraph with the corresponding class and text from the specialPrice property into the card.

After we are done, let’s test the function once again. In the data object, change the value of the isSpecial to true and specialPrice to 300 (value null means “nothing” or, if applied closer to our real-life scenario, “there are no special prices”). If everything is done correctly, the appearance of the card will change.

Why did the price change from 200 to 300? Because this way the skillful marketer Muffin can interpret the special offer.