Easy there, pal!
To access the Introduction to JavaScript in the browser challenges in the Deep dive in JavaScript for browsers, you need to sign up first.
As soon as you were done with one task, Muffin showed up with another one.
Meow! Do you remember the ice cream shop? You need to create product cards based on the data received from the server.
The
cardsDataarray contains one object for each product. Each object has the following properties:
inStock: product availability. If the value istrue, the product is available (for such a product, the designer created thegood--availableclass); if it isfalse, the product is not available (product with thegood--unavailableclass).imgUrl: link to the product image.text: the product name.price: the product price.isHit: defines if the product is a bestseller. If the value istrue, the product is a bestseller. For such a product, classgood--hitwas created.specialOffer: a special offer, which is only available for bestsellers. Must be in a paragraph with classgood__special-offerand must be the last child element in the card.Here is an example of the markup of one card in the catalog:
<ul class="goods"> <li class="good"> <h2 class="good__description">Creamy coffee with chocolate chip</h2> <img class="good__image" src="gllacy/choco.jpg" alt="Creamy coffee with chocolate chip"> <p class="good__price">110 ₽/kg</p> </li> … </ul>Note that the text in the
altattribute of the image must be the same as the name of the product.Create a
renderCardsfunction that takes an array of product data and displays the ice cream cards on the page. Call it withcardsDataas the argument.
Note the order in which the elements appear in the product card. Remember that when you insert with appendChild, the elements are added to the end of the parent.
To create a string with a price, use the following concatenation: price + ' ₽/kg'.
When you are done, press Hey boss, here’s your program! to show Muffin the results of your work.
You’ve gone to a different page
Click inside the mini-browser to shift the focus onto this window.
To access the Introduction to JavaScript in the browser challenges in the Deep dive in JavaScript for browsers, you need to sign up first.
Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.
Forgot to connect your email to the profile? Email us and we’ll help.