mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-14 10:01:58 -04:00
refactor(curriculum): use Dessert class in shopping cart workshop (#66890)
Signed-off-by: Umesh Tiruvalluru <tiruvalluruumesh@gmail.com> Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b316a368c4
commit
aa6df83ac1
@@ -1,52 +1,52 @@
|
||||
---
|
||||
id: 63ec20a06fff670d37befbd9
|
||||
title: Step 6
|
||||
title: Step 7
|
||||
challengeType: 0
|
||||
dashedName: step-6
|
||||
dashedName: step-7
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
You now need to start adding products. Before you do that, you need to consider the structure of your product data. A product will need a unique identifier to distinguish it from other products, a price so people know how much it costs, and a name so people know what they are buying. You should also add a category to each product.
|
||||
Now that you have a `Dessert` class, you can use it to create products. Each call to `new Dessert(...)` returns a new instance with the same shape, which is much shorter to write than a full object literal.
|
||||
|
||||
Add an object to your `products` array. Give this object an `id` property set to the number `1`, a `name` property set to the string `"Vanilla Cupcakes (6 Pack)"`, a `price` property set to the number `12.99`, and a `category` property set to the string `"Cupcake"`.
|
||||
Add a single value to your `products` array by calling `new Dessert()` with these arguments, in order: the number `1`, the string `"Vanilla Cupcakes (6 Pack)"`, the number `12.99`, and the string `"Cupcake"`.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your products array should have one value.
|
||||
Your `products` array should have one value.
|
||||
|
||||
```js
|
||||
assert.equal(products.length, 1);
|
||||
assert.strictEqual(products.length, 1);
|
||||
```
|
||||
|
||||
Your products array should have an object as its first value.
|
||||
The first value of your `products` array should be an instance of `Dessert`.
|
||||
|
||||
```js
|
||||
assert.isObject(products[0]);
|
||||
assert.instanceOf(products[0], Dessert);
|
||||
```
|
||||
|
||||
Your products array should have an object with an `id` property set to the number `1`.
|
||||
Your first product should have an `id` property set to the number `1`.
|
||||
|
||||
```js
|
||||
assert.equal(products[0].id, 1);
|
||||
assert.strictEqual(products[0].id, 1);
|
||||
```
|
||||
|
||||
Your products array should have an object with a `name` property set to the string `"Vanilla Cupcakes (6 Pack)"`.
|
||||
Your first product should have a `name` property set to the string `"Vanilla Cupcakes (6 Pack)"`.
|
||||
|
||||
```js
|
||||
assert.equal(products[0].name, 'Vanilla Cupcakes (6 Pack)');
|
||||
assert.strictEqual(products[0].name, 'Vanilla Cupcakes (6 Pack)');
|
||||
```
|
||||
|
||||
Your products array should have an object with a `price` property set to the number `12.99`.
|
||||
Your first product should have a `price` property set to the number `12.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[0].price, 12.99);
|
||||
assert.strictEqual(products[0].price, 12.99);
|
||||
```
|
||||
|
||||
Your products array should have an object with a `category` property set to the string `"Cupcake"`.
|
||||
Your first product should have a `category` property set to the string `"Cupcake"`.
|
||||
|
||||
```js
|
||||
assert.equal(products[0].category, 'Cupcake');
|
||||
assert.strictEqual(products[0].category, 'Cupcake');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -218,6 +218,15 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
--fcc-editable-region--
|
||||
const products = [
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
id: 63ec3287b182ec0efe8a3135
|
||||
title: Step 7
|
||||
title: Step 8
|
||||
challengeType: 0
|
||||
dashedName: step-7
|
||||
dashedName: step-8
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Following that same data structure, add the products from this table (in order) to your `products` array. Increment the `id` for each product, counting up.
|
||||
Add the remaining products from this table (in order) to your `products` array using `new Dessert(...)`. Increment the `id` for each product, counting up.
|
||||
|
||||
| `name` | `price` | `category` |
|
||||
| ------------------------------ | ------- | ----------- |
|
||||
@@ -25,268 +25,275 @@ Following that same data structure, add the products from this table (in order)
|
||||
|
||||
# --hints--
|
||||
|
||||
Your second object in the `products` array should have an `id` property set to the number `2`.
|
||||
Your second product should have an `id` property set to the number `2`.
|
||||
|
||||
```js
|
||||
assert.equal(products[1].id, 2);
|
||||
assert.strictEqual(products[1].id, 2);
|
||||
```
|
||||
|
||||
Your second object in the `products` array should have a `name` property set to `French Macaron`.
|
||||
Your second product should have a `name` property set to `French Macaron`.
|
||||
|
||||
```js
|
||||
assert.equal(products[1].name, 'French Macaron');
|
||||
assert.strictEqual(products[1].name, 'French Macaron');
|
||||
```
|
||||
|
||||
Your second object in the `products` array should have a `price` property set to the number `3.99`.
|
||||
Your second product should have a `price` property set to the number `3.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[1].price, 3.99);
|
||||
assert.strictEqual(products[1].price, 3.99);
|
||||
```
|
||||
|
||||
Your second object in the `products` array should have a `category` property set to `Macaron`.
|
||||
Your second product should have a `category` property set to `Macaron`.
|
||||
|
||||
```js
|
||||
assert.equal(products[1].category, 'Macaron');
|
||||
assert.strictEqual(products[1].category, 'Macaron');
|
||||
```
|
||||
|
||||
Your third object in the `products` array should have an `id` property set to the number `3`.
|
||||
Your third product should have an `id` property set to the number `3`.
|
||||
|
||||
```js
|
||||
assert.equal(products[2].id, 3);
|
||||
assert.strictEqual(products[2].id, 3);
|
||||
```
|
||||
|
||||
Your third object in the `products` array should have a `name` property set to `Pumpkin Cupcake`.
|
||||
Your third product should have a `name` property set to `Pumpkin Cupcake`.
|
||||
|
||||
```js
|
||||
assert.equal(products[2].name, 'Pumpkin Cupcake');
|
||||
assert.strictEqual(products[2].name, 'Pumpkin Cupcake');
|
||||
```
|
||||
|
||||
Your third object in the `products` array should have a `price` property set to the number `3.99`.
|
||||
Your third product should have a `price` property set to the number `3.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[2].price, 3.99);
|
||||
assert.strictEqual(products[2].price, 3.99);
|
||||
```
|
||||
|
||||
Your third object in the `products` array should have a `category` property set to `Cupcake`.
|
||||
Your third product should have a `category` property set to `Cupcake`.
|
||||
|
||||
```js
|
||||
assert.equal(products[2].category, 'Cupcake');
|
||||
assert.strictEqual(products[2].category, 'Cupcake');
|
||||
```
|
||||
|
||||
Your fourth object in the `products` array should have an `id` property set to the number `4`.
|
||||
Your fourth product should have an `id` property set to the number `4`.
|
||||
|
||||
```js
|
||||
assert.equal(products[3].id, 4);
|
||||
assert.strictEqual(products[3].id, 4);
|
||||
```
|
||||
|
||||
Your fourth object in the `products` array should have a `name` property set to `Chocolate Cupcake`.
|
||||
Your fourth product should have a `name` property set to `Chocolate Cupcake`.
|
||||
|
||||
```js
|
||||
assert.equal(products[3].name, 'Chocolate Cupcake');
|
||||
assert.strictEqual(products[3].name, 'Chocolate Cupcake');
|
||||
```
|
||||
|
||||
Your fourth object in the `products` array should have a `price` property set to the number `5.99`.
|
||||
Your fourth product should have a `price` property set to the number `5.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[3].price, 5.99);
|
||||
assert.strictEqual(products[3].price, 5.99);
|
||||
```
|
||||
|
||||
Your fourth object in the `products` array should have a `category` property set to `Cupcake`.
|
||||
Your fourth product should have a `category` property set to `Cupcake`.
|
||||
|
||||
```js
|
||||
assert.equal(products[3].category, 'Cupcake');
|
||||
assert.strictEqual(products[3].category, 'Cupcake');
|
||||
```
|
||||
|
||||
Your fifth object in the `products` array should have an `id` property set to the number `5`.
|
||||
Your fifth product should have an `id` property set to the number `5`.
|
||||
|
||||
```js
|
||||
assert.equal(products[4].id, 5);
|
||||
assert.strictEqual(products[4].id, 5);
|
||||
```
|
||||
|
||||
Your fifth object in the `products` array should have a `name` property set to `Chocolate Pretzels (4 Pack)`.
|
||||
Your fifth product should have a `name` property set to `Chocolate Pretzels (4 Pack)`.
|
||||
|
||||
```js
|
||||
assert.equal(products[4].name, 'Chocolate Pretzels (4 Pack)');
|
||||
assert.strictEqual(products[4].name, 'Chocolate Pretzels (4 Pack)');
|
||||
```
|
||||
|
||||
Your fifth object in the `products` array should have a `price` property set to the number `10.99`.
|
||||
Your fifth product should have a `price` property set to the number `10.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[4].price, 10.99);
|
||||
assert.strictEqual(products[4].price, 10.99);
|
||||
```
|
||||
|
||||
Your fifth object in the `products` array should have a `category` property set to `Pretzel`.
|
||||
Your fifth product should have a `category` property set to `Pretzel`.
|
||||
|
||||
```js
|
||||
assert.equal(products[4].category, 'Pretzel');
|
||||
assert.strictEqual(products[4].category, 'Pretzel');
|
||||
```
|
||||
|
||||
Your sixth object in the `products` array should have an `id` property set to the number `6`.
|
||||
Your sixth product should have an `id` property set to the number `6`.
|
||||
|
||||
```js
|
||||
assert.equal(products[5].id, 6);
|
||||
assert.strictEqual(products[5].id, 6);
|
||||
```
|
||||
|
||||
Your sixth object in the `products` array should have a `name` property set to `Strawberry Ice Cream`.
|
||||
Your sixth product should have a `name` property set to `Strawberry Ice Cream`.
|
||||
|
||||
```js
|
||||
assert.equal(products[5].name, 'Strawberry Ice Cream');
|
||||
assert.strictEqual(products[5].name, 'Strawberry Ice Cream');
|
||||
```
|
||||
|
||||
Your sixth object in the `products` array should have a `price` property set to the number `2.99`.
|
||||
Your sixth product should have a `price` property set to the number `2.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[5].price, 2.99);
|
||||
assert.strictEqual(products[5].price, 2.99);
|
||||
```
|
||||
|
||||
Your sixth object in the `products` array should have a `category` property set to `Ice Cream`.
|
||||
Your sixth product should have a `category` property set to `Ice Cream`.
|
||||
|
||||
```js
|
||||
assert.equal(products[5].category, 'Ice Cream');
|
||||
assert.strictEqual(products[5].category, 'Ice Cream');
|
||||
```
|
||||
|
||||
Your seventh object in the `products` array should have an `id` property set to the number `7`.
|
||||
Your seventh product should have an `id` property set to the number `7`.
|
||||
|
||||
```js
|
||||
assert.equal(products[6].id, 7);
|
||||
assert.strictEqual(products[6].id, 7);
|
||||
```
|
||||
|
||||
Your seventh object in the `products` array should have a `name` property set to `Chocolate Macarons (4 Pack)`.
|
||||
Your seventh product should have a `name` property set to `Chocolate Macarons (4 Pack)`.
|
||||
|
||||
```js
|
||||
assert.equal(products[6].name, 'Chocolate Macarons (4 Pack)');
|
||||
assert.strictEqual(products[6].name, 'Chocolate Macarons (4 Pack)');
|
||||
```
|
||||
|
||||
Your seventh object in the `products` array should have a `price` property set to the number `9.99`.
|
||||
Your seventh product should have a `price` property set to the number `9.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[6].price, 9.99);
|
||||
assert.strictEqual(products[6].price, 9.99);
|
||||
```
|
||||
|
||||
Your seventh object in the `products` array should have a `category` property set to `Macaron`.
|
||||
Your seventh product should have a `category` property set to `Macaron`.
|
||||
|
||||
```js
|
||||
assert.equal(products[6].category, 'Macaron');
|
||||
assert.strictEqual(products[6].category, 'Macaron');
|
||||
```
|
||||
|
||||
Your eighth object in the `products` array should have an `id` property set to the number `8`.
|
||||
Your eighth product should have an `id` property set to the number `8`.
|
||||
|
||||
```js
|
||||
assert.equal(products[7].id, 8);
|
||||
assert.strictEqual(products[7].id, 8);
|
||||
```
|
||||
|
||||
Your eighth object in the `products` array should have a `name` property set to `Strawberry Pretzel`.
|
||||
Your eighth product should have a `name` property set to `Strawberry Pretzel`.
|
||||
|
||||
```js
|
||||
assert.equal(products[7].name, 'Strawberry Pretzel');
|
||||
assert.strictEqual(products[7].name, 'Strawberry Pretzel');
|
||||
```
|
||||
|
||||
Your eighth object in the `products` array should have a `price` property set to the number `4.99`.
|
||||
Your eighth product should have a `price` property set to the number `4.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[7].price, 4.99);
|
||||
assert.strictEqual(products[7].price, 4.99);
|
||||
```
|
||||
|
||||
Your eighth object in the `products` array should have a `category` property set to `Pretzel`.
|
||||
Your eighth product should have a `category` property set to `Pretzel`.
|
||||
|
||||
```js
|
||||
assert.equal(products[7].category, 'Pretzel');
|
||||
assert.strictEqual(products[7].category, 'Pretzel');
|
||||
```
|
||||
|
||||
Your ninth object in the `products` array should have an `id` property set to the number `9`.
|
||||
Your ninth product should have an `id` property set to the number `9`.
|
||||
|
||||
```js
|
||||
assert.equal(products[8].id, 9);
|
||||
assert.strictEqual(products[8].id, 9);
|
||||
```
|
||||
|
||||
Your ninth object in the `products` array should have a `name` property set to `Butter Pecan Ice Cream`.
|
||||
Your ninth product should have a `name` property set to `Butter Pecan Ice Cream`.
|
||||
|
||||
```js
|
||||
assert.equal(products[8].name, 'Butter Pecan Ice Cream');
|
||||
assert.strictEqual(products[8].name, 'Butter Pecan Ice Cream');
|
||||
```
|
||||
|
||||
Your ninth object in the `products` array should have a `price` property set to the number `2.99`.
|
||||
Your ninth product should have a `price` property set to the number `2.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[8].price, 2.99);
|
||||
assert.strictEqual(products[8].price, 2.99);
|
||||
```
|
||||
|
||||
Your ninth object in the `products` array should have a `category` property set to `Ice Cream`.
|
||||
Your ninth product should have a `category` property set to `Ice Cream`.
|
||||
|
||||
```js
|
||||
assert.equal(products[8].category, 'Ice Cream');
|
||||
assert.strictEqual(products[8].category, 'Ice Cream');
|
||||
```
|
||||
|
||||
Your tenth object in the `products` array should have an `id` property set to the number `10`.
|
||||
Your tenth product should have an `id` property set to the number `10`.
|
||||
|
||||
```js
|
||||
assert.equal(products[9].id, 10);
|
||||
assert.strictEqual(products[9].id, 10);
|
||||
```
|
||||
|
||||
Your tenth object in the `products` array should have a `name` property set to `Rocky Road Ice Cream`.
|
||||
Your tenth product should have a `name` property set to `Rocky Road Ice Cream`.
|
||||
|
||||
```js
|
||||
assert.equal(products[9].name, 'Rocky Road Ice Cream');
|
||||
assert.strictEqual(products[9].name, 'Rocky Road Ice Cream');
|
||||
```
|
||||
|
||||
Your tenth object in the `products` array should have a `price` property set to the number `2.99`.
|
||||
Your tenth product should have a `price` property set to the number `2.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[9].price, 2.99);
|
||||
assert.strictEqual(products[9].price, 2.99);
|
||||
```
|
||||
|
||||
Your tenth object in the `products` array should have a `category` property set to `Ice Cream`.
|
||||
Your tenth product should have a `category` property set to `Ice Cream`.
|
||||
|
||||
```js
|
||||
assert.equal(products[9].category, 'Ice Cream');
|
||||
assert.strictEqual(products[9].category, 'Ice Cream');
|
||||
```
|
||||
|
||||
Your eleventh object in the `products` array should have an `id` property set to the number `11`.
|
||||
Your eleventh product should have an `id` property set to the number `11`.
|
||||
|
||||
```js
|
||||
assert.equal(products[10].id, 11);
|
||||
assert.strictEqual(products[10].id, 11);
|
||||
```
|
||||
|
||||
Your eleventh object in the `products` array should have a `name` property set to `Vanilla Macarons (5 Pack)`.
|
||||
Your eleventh product should have a `name` property set to `Vanilla Macarons (5 Pack)`.
|
||||
|
||||
```js
|
||||
assert.equal(products[10].name, 'Vanilla Macarons (5 Pack)');
|
||||
assert.strictEqual(products[10].name, 'Vanilla Macarons (5 Pack)');
|
||||
```
|
||||
|
||||
Your eleventh object in the `products` array should have a `price` property set to the number `11.99`.
|
||||
Your eleventh product should have a `price` property set to the number `11.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[10].price, 11.99);
|
||||
assert.strictEqual(products[10].price, 11.99);
|
||||
```
|
||||
|
||||
Your eleventh object in the `products` array should have a `category` property set to `Macaron`.
|
||||
Your eleventh product should have a `category` property set to `Macaron`.
|
||||
|
||||
```js
|
||||
assert.equal(products[10].category, 'Macaron');
|
||||
assert.strictEqual(products[10].category, 'Macaron');
|
||||
```
|
||||
|
||||
Your twelfth object in the `products` array should have an `id` property set to the number `12`.
|
||||
Your twelfth product should have an `id` property set to the number `12`.
|
||||
|
||||
```js
|
||||
assert.equal(products[11].id, 12);
|
||||
assert.strictEqual(products[11].id, 12);
|
||||
```
|
||||
|
||||
Your twelfth object in the `products` array should have a `name` property set to `Lemon Cupcakes (4 Pack)`.
|
||||
Your twelfth product should have a `name` property set to `Lemon Cupcakes (4 Pack)`.
|
||||
|
||||
```js
|
||||
assert.equal(products[11].name, 'Lemon Cupcakes (4 Pack)');
|
||||
assert.strictEqual(products[11].name, 'Lemon Cupcakes (4 Pack)');
|
||||
```
|
||||
|
||||
Your twelfth object in the `products` array should have a `price` property set to the number `12.99`.
|
||||
Your twelfth product should have a `price` property set to the number `12.99`.
|
||||
|
||||
```js
|
||||
assert.equal(products[11].price, 12.99);
|
||||
assert.strictEqual(products[11].price, 12.99);
|
||||
```
|
||||
|
||||
Your twelfth object in the `products` array should have a `category` property set to `Cupcake`.
|
||||
Your twelfth product should have a `category` property set to `Cupcake`.
|
||||
|
||||
```js
|
||||
assert.equal(products[11].category, 'Cupcake');
|
||||
assert.strictEqual(products[11].category, 'Cupcake');
|
||||
```
|
||||
|
||||
Your `products` array should have 12 values, each an instance of `Dessert`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(products.length, 12);
|
||||
products.forEach(p => assert.instanceOf(p, Dessert));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -458,14 +465,18 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
--fcc-editable-region--
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
|
||||
];
|
||||
--fcc-editable-region--
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63ec3427fc3e9214c9ed2a14
|
||||
title: Step 8
|
||||
title: Step 9
|
||||
challengeType: 0
|
||||
dashedName: step-8
|
||||
dashedName: step-9
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -200,79 +200,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
---
|
||||
id: 63ec36f6133df7160be3ec66
|
||||
title: Step 9
|
||||
title: Step 10
|
||||
challengeType: 0
|
||||
dashedName: step-9
|
||||
dashedName: step-10
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Remember that you can use destructuring to extract multiple values from an array or object in a single statement.
|
||||
|
||||
For the first parameter of your callback function, destructure the `name`, `id`, `price`, and `category` properties from the object passed in.
|
||||
For the first parameter of your callback function, destructure the `name`, `id`, `price`, and `category` properties from the `Dessert` instance passed in.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -194,79 +194,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63ec47b454495519739486a7
|
||||
title: Step 10
|
||||
title: Step 11
|
||||
challengeType: 0
|
||||
dashedName: step-10
|
||||
dashedName: step-11
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -11,7 +11,7 @@ You need to display the available products in your HTML. Start by using the addi
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use access the `innerHTML` property of the `dessertCards` variable.
|
||||
You should access the `innerHTML` property of the `dessertCards` variable.
|
||||
|
||||
```js
|
||||
assert.match(code, /dessertCards\.innerHTML/);
|
||||
@@ -198,79 +198,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63ee5d38a5d29d0696f8d820
|
||||
title: Step 11
|
||||
title: Step 12
|
||||
challengeType: 0
|
||||
dashedName: step-11
|
||||
dashedName: step-12
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -20,7 +20,7 @@ assert.isAtLeast(document.querySelectorAll('div')?.length, 12);
|
||||
Your `div` element should have a class of `dessert-card`.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('.dessert-card')?.length, 12);
|
||||
assert.strictEqual(document.querySelectorAll('.dessert-card')?.length, 12);
|
||||
```
|
||||
|
||||
You should create an `h2` element.
|
||||
@@ -32,13 +32,13 @@ assert.isAtLeast(document.querySelectorAll('h2')?.length, 12);
|
||||
Your `h2` element should have the text of the `name` variable.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('h2')[0]?.textContent, 'Vanilla Cupcakes (6 Pack)');
|
||||
assert.strictEqual(document.querySelectorAll('h2')[0]?.textContent, 'Vanilla Cupcakes (6 Pack)');
|
||||
```
|
||||
|
||||
Your `h2` element should be inside the `div` element.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('div h2')?.length, 12);
|
||||
assert.strictEqual(document.querySelectorAll('div h2')?.length, 12);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -210,79 +210,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63ee5d8f9e7168076e932fe2
|
||||
title: Step 12
|
||||
title: Step 13
|
||||
challengeType: 0
|
||||
dashedName: step-12
|
||||
dashedName: step-13
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -14,40 +14,40 @@ After your `h2` element, create two `p` elements. Give the first a `class` of `d
|
||||
You should create two `p` elements.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card')?.children.length, 3);
|
||||
assert.equal(document.querySelector('.dessert-card')?.querySelectorAll('p')?.length, 2)
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children.length, 3);
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.querySelectorAll('p')?.length, 2)
|
||||
```
|
||||
|
||||
Your `p` elements should come after your `h2` element.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card')?.children[0].tagName, 'H2');
|
||||
assert.equal(document.querySelector('.dessert-card')?.children[1].tagName, 'P');
|
||||
assert.equal(document.querySelector('.dessert-card')?.children[2].tagName, 'P');
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children[0].tagName, 'H2');
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children[1].tagName, 'P');
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children[2].tagName, 'P');
|
||||
```
|
||||
|
||||
Your first `p` element should have a `class` of `dessert-price`.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card')?.children[1].className, 'dessert-price');
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children[1].className, 'dessert-price');
|
||||
```
|
||||
|
||||
Your first `p` element should have the dollar sign `"$"` followed by the value of the `price` variable.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card')?.children[1].textContent, '$12.99');
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children[1].textContent, '$12.99');
|
||||
```
|
||||
|
||||
Your second `p` element should have a `class` of `product-category`.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card')?.children[2].className, 'product-category');
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children[2].className, 'product-category');
|
||||
```
|
||||
|
||||
Your second `p` element should have the text `"Category: "` followed by the value of the `category` variable.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card')?.children[2].textContent, 'Category: Cupcake');
|
||||
assert.strictEqual(document.querySelector('.dessert-card')?.children[2].textContent, 'Category: Cupcake');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -219,79 +219,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63ee5e0f08e82208364c4128
|
||||
title: Step 13
|
||||
title: Step 14
|
||||
challengeType: 0
|
||||
dashedName: step-13
|
||||
dashedName: step-14
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -14,20 +14,20 @@ Finally, after your `p` elements, create a `button` element. Give it an `id` set
|
||||
You should create a `button` element.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('.dessert-card button')?.length, 12);
|
||||
assert.strictEqual(document.querySelectorAll('.dessert-card button')?.length, 12);
|
||||
```
|
||||
|
||||
Your `button` element should come after your `p` elements.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card button')?.previousElementSibling?.tagName, 'P');
|
||||
assert.strictEqual(document.querySelector('.dessert-card button')?.previousElementSibling?.tagName, 'P');
|
||||
assert.isNull(document.querySelector('.dessert-card button')?.nextElementSibling);
|
||||
```
|
||||
|
||||
Your `button` element should have an `id` set to the value of the `id` variable.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card button')?.id, '1');
|
||||
assert.strictEqual(document.querySelector('.dessert-card button')?.id, '1');
|
||||
```
|
||||
|
||||
Your `button` element should have a `class` of `btn add-to-cart-btn`.
|
||||
@@ -40,7 +40,7 @@ assert.include(document.querySelector('.dessert-card button')?.className, 'add-t
|
||||
Your `button` element should have the text `"Add to cart"`.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('.dessert-card button')?.textContent?.trim(), 'Add to cart');
|
||||
assert.strictEqual(document.querySelector('.dessert-card button')?.textContent?.trim(), 'Add to cart');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -212,79 +212,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
@@ -1,21 +1,13 @@
|
||||
---
|
||||
id: 63ee5ea8be892e0955ab346c
|
||||
title: Step 14
|
||||
title: Step 15
|
||||
challengeType: 0
|
||||
dashedName: step-14
|
||||
dashedName: step-15
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
You are already familiar with an HTML `class`, but JavaScript also has a <dfn>class</dfn>. In JavaScript, a class is like a blueprint for creating objects. It allows you to define a set of properties and methods, and instantiate (or create) new objects with those properties and methods.
|
||||
|
||||
The `class` keyword is used to declare a class. Here is an example of declaring a `Computer` class:
|
||||
|
||||
```js
|
||||
class Computer {};
|
||||
```
|
||||
|
||||
Declare a `ShoppingCart` class.
|
||||
Now that you have created a `Dessert` class, create a `ShoppingCart` class.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -206,79 +198,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63ee5fc113bcb20a5db9214b
|
||||
title: Step 15
|
||||
title: Step 16
|
||||
challengeType: 0
|
||||
dashedName: step-15
|
||||
dashedName: step-16
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -201,79 +201,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
id: 63ee611d478dca0b77f6a393
|
||||
title: Step 16
|
||||
title: Step 17
|
||||
challengeType: 0
|
||||
dashedName: step-16
|
||||
dashedName: step-17
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
The `this` keyword in JavaScript is used to refer to the current object. Depending on where `this` is used, what it references changes. In the case of a class, it refers to the instance of the object being constructed. You can use the `this` keyword to set the properties of the object being instantiated. Here is an example:
|
||||
You learned in a previous lecture that the `this` keyword refers to the current instance being constructed, as you saw in the `Dessert` constructor. Here, you will apply the same idea to the `ShoppingCart` class.
|
||||
|
||||
```js
|
||||
class Computer {
|
||||
@@ -35,7 +35,7 @@ You should use the `this` keyword to set the `total` property of your class to `
|
||||
```js
|
||||
assert.match(code, /this\.total/);
|
||||
const cart = new ShoppingCart();
|
||||
assert.equal(cart.total, 0);
|
||||
assert.strictEqual(cart.total, 0);
|
||||
```
|
||||
|
||||
You should use the `this` keyword to set the `taxRate` property of your class to `8.25`.
|
||||
@@ -43,7 +43,7 @@ You should use the `this` keyword to set the `taxRate` property of your class to
|
||||
```js
|
||||
assert.match(code, /this\.taxRate/);
|
||||
const cart = new ShoppingCart();
|
||||
assert.equal(cart.taxRate, 8.25);
|
||||
assert.strictEqual(cart.taxRate, 8.25);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -215,79 +215,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63ee7c664f9b65137d925c8a
|
||||
title: Step 17
|
||||
title: Step 18
|
||||
challengeType: 0
|
||||
dashedName: step-17
|
||||
dashedName: step-18
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -21,7 +21,7 @@ class Computer {
|
||||
}
|
||||
```
|
||||
|
||||
The first parameter, `id`, is the `id` of the product the user has added to their cart. The second parameter, `products`, is an array of product objects. By using a parameter instead of directly referencing your existing `products` array, this method will be more flexible if you wanted to add additional product lists in the future.
|
||||
The first parameter, `id`, is the `id` of the product the user has added to their cart. The second parameter, `products`, is an array of `Dessert` instances. By using a parameter instead of directly referencing your existing `products` array, this method will be more flexible if you wanted to add additional product lists in the future.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -216,79 +216,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63eea5cea403a81a68ae493c
|
||||
title: Step 18
|
||||
title: Step 19
|
||||
challengeType: 0
|
||||
dashedName: step-18
|
||||
dashedName: step-19
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -227,79 +227,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63eea817673c8e1c22927fa6
|
||||
title: Step 19
|
||||
title: Step 20
|
||||
challengeType: 0
|
||||
dashedName: step-19
|
||||
dashedName: step-20
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -201,79 +201,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63eea8e1e143ae1d098c8c9d
|
||||
title: Step 20
|
||||
title: Step 21
|
||||
challengeType: 0
|
||||
dashedName: step-20
|
||||
dashedName: step-21
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -202,79 +202,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63eeb8e86becbf1e75c2cb0d
|
||||
title: Step 21
|
||||
title: Step 22
|
||||
challengeType: 0
|
||||
dashedName: step-21
|
||||
dashedName: step-22
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -201,79 +201,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63eedebb0ec0231ff1cede1a
|
||||
title: Step 22
|
||||
title: Step 23
|
||||
challengeType: 0
|
||||
dashedName: step-22
|
||||
dashedName: step-23
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -215,79 +215,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63efdbc22a0c56070beabed7
|
||||
title: Step 23
|
||||
title: Step 24
|
||||
challengeType: 0
|
||||
dashedName: step-23
|
||||
dashedName: step-24
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -218,79 +218,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63efe370bbfc4a08d500118e
|
||||
title: Step 24
|
||||
title: Step 25
|
||||
challengeType: 0
|
||||
dashedName: step-24
|
||||
dashedName: step-25
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -208,79 +208,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63eff02f00e69a0b2ac10b43
|
||||
title: Step 25
|
||||
title: Step 26
|
||||
challengeType: 0
|
||||
dashedName: step-25
|
||||
dashedName: step-26
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -201,79 +201,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63eff98ffb1d5a0d24ec79cb
|
||||
title: Step 26
|
||||
title: Step 27
|
||||
challengeType: 0
|
||||
dashedName: step-26
|
||||
dashedName: step-27
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -219,79 +219,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63effe558c87a70e7072e447
|
||||
title: Step 27
|
||||
title: Step 28
|
||||
challengeType: 0
|
||||
dashedName: step-27
|
||||
dashedName: step-28
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -208,79 +208,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0165121a9181342d5bc66
|
||||
title: Step 28
|
||||
title: Step 29
|
||||
challengeType: 0
|
||||
dashedName: step-28
|
||||
dashedName: step-29
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -201,79 +201,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f017b4ad028a148eb713c0
|
||||
title: Step 29
|
||||
title: Step 30
|
||||
challengeType: 0
|
||||
dashedName: step-29
|
||||
dashedName: step-30
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -36,7 +36,7 @@ You should add a `div` to the `productsContainer`.
|
||||
```js
|
||||
const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
assert.equal(productsContainer.children?.[0]?.tagName, "DIV");
|
||||
assert.strictEqual(productsContainer.children?.[0]?.tagName, "DIV");
|
||||
```
|
||||
|
||||
Your `div` should have the `class` set to `product`.
|
||||
@@ -44,7 +44,7 @@ Your `div` should have the `class` set to `product`.
|
||||
```js
|
||||
const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
assert.equal(productsContainer.children?.[0]?.className, "product");
|
||||
assert.strictEqual(productsContainer.children?.[0]?.className, "product");
|
||||
```
|
||||
|
||||
Your `div` should have the `id` set to `dessert${id}`.
|
||||
@@ -52,7 +52,7 @@ Your `div` should have the `id` set to `dessert${id}`.
|
||||
```js
|
||||
const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
assert.equal(productsContainer.children?.[0]?.id, "dessert1");
|
||||
assert.strictEqual(productsContainer.children?.[0]?.id, "dessert1");
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -224,79 +224,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f01861f813e01564c95315
|
||||
title: Step 30
|
||||
title: Step 31
|
||||
challengeType: 0
|
||||
dashedName: step-30
|
||||
dashedName: step-31
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -17,9 +17,9 @@ You should add two `p` elements inside your `div` element.
|
||||
const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
const div = document.querySelector('.product');
|
||||
assert.equal(div?.children.length, 2);
|
||||
assert.equal(div?.children[0].tagName, 'P');
|
||||
assert.equal(div?.children[1].tagName, 'P');
|
||||
assert.strictEqual(div?.children.length, 2);
|
||||
assert.strictEqual(div?.children[0].tagName, 'P');
|
||||
assert.strictEqual(div?.children[1].tagName, 'P');
|
||||
```
|
||||
|
||||
Your second `p` element should have the text of the `price` variable.
|
||||
@@ -28,7 +28,7 @@ Your second `p` element should have the text of the `price` variable.
|
||||
const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
const div = document.querySelector('.product');
|
||||
assert.equal(div?.children[1].textContent, '12.99');
|
||||
assert.strictEqual(div?.children[1].textContent, '12.99');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -200,79 +200,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f018f04e487e164dc27bd9
|
||||
title: Step 31
|
||||
title: Step 32
|
||||
challengeType: 0
|
||||
dashedName: step-31
|
||||
dashedName: step-32
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -18,8 +18,8 @@ const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
const div = document.querySelector('.product');
|
||||
const p = div.querySelector('p');
|
||||
assert.equal(p.children.length, 1);
|
||||
assert.equal(p.children[0].tagName, 'SPAN');
|
||||
assert.strictEqual(p.children.length, 1);
|
||||
assert.strictEqual(p.children[0].tagName, 'SPAN');
|
||||
```
|
||||
|
||||
Your `span` element should have a `class` of `product-count`.
|
||||
@@ -29,7 +29,7 @@ const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
const div = document.querySelector('.product');
|
||||
const p = div.querySelector('p');
|
||||
assert.equal(p.children[0].className, 'product-count');
|
||||
assert.strictEqual(p.children[0].className, 'product-count');
|
||||
```
|
||||
|
||||
Your `span` element should have an `id` of `product-count-for-id${id}`.
|
||||
@@ -39,7 +39,7 @@ const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
const div = document.querySelector('.product');
|
||||
const p = div.querySelector('p');
|
||||
assert.equal(p.children[0].id, 'product-count-for-id1');
|
||||
assert.strictEqual(p.children[0].id, 'product-count-for-id1');
|
||||
```
|
||||
|
||||
Your first `p` element should have the text of the `name` variable. This should be outside the span.
|
||||
@@ -49,7 +49,7 @@ const cart = new ShoppingCart();
|
||||
cart.addItem(1, products);
|
||||
const div = document.querySelector('.product');
|
||||
const p = div.querySelector('p');
|
||||
assert.equal(p.innerText.trim(), 'Vanilla Cupcakes (6 Pack)');
|
||||
assert.strictEqual(p.innerText.trim(), 'Vanilla Cupcakes (6 Pack)');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -221,79 +221,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f01c9791a0aa1751c73760
|
||||
title: Step 32
|
||||
title: Step 33
|
||||
challengeType: 0
|
||||
dashedName: step-32
|
||||
dashedName: step-33
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -204,79 +204,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0224ceb16dc196d2c860a
|
||||
title: Step 33
|
||||
title: Step 34
|
||||
challengeType: 0
|
||||
dashedName: step-33
|
||||
dashedName: step-34
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -204,79 +204,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f026d041bc6c1a3d5cba0f
|
||||
title: Step 34
|
||||
title: Step 35
|
||||
challengeType: 0
|
||||
dashedName: step-34
|
||||
dashedName: step-35
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -206,79 +206,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0284532742c1b26c7a052
|
||||
title: Step 35
|
||||
title: Step 36
|
||||
challengeType: 0
|
||||
dashedName: step-35
|
||||
dashedName: step-36
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -204,79 +204,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0289df84a581bbdbd29b7
|
||||
title: Step 36
|
||||
title: Step 37
|
||||
challengeType: 0
|
||||
dashedName: step-36
|
||||
dashedName: step-37
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -200,79 +200,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0295e673b661ccb299e8a
|
||||
title: Step 41
|
||||
title: Step 42
|
||||
challengeType: 0
|
||||
dashedName: step-41
|
||||
dashedName: step-42
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -29,9 +29,9 @@ assert.match(afterCounts, /this\s*\.\s*items\s*\.\s*length/);
|
||||
Your `getCounts` method should return the number of items in the `items` array.
|
||||
|
||||
```js
|
||||
assert.equal(cart.getCounts(), 0);
|
||||
assert.strictEqual(cart.getCounts(), 0);
|
||||
cart.addItem(1, products);
|
||||
assert.equal(cart.getCounts(), 1);
|
||||
assert.strictEqual(cart.getCounts(), 1);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -203,79 +203,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f029b96b9e9e1df93be951
|
||||
title: Step 42
|
||||
title: Step 43
|
||||
challengeType: 0
|
||||
dashedName: step-42
|
||||
dashedName: step-43
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -192,79 +192,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f02a4ef92d711ec1ff618c
|
||||
title: Step 43
|
||||
title: Step 44
|
||||
challengeType: 0
|
||||
dashedName: step-43
|
||||
dashedName: step-44
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -225,79 +225,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f02b22cce1c11fe9604381
|
||||
title: Step 44
|
||||
title: Step 45
|
||||
challengeType: 0
|
||||
dashedName: step-44
|
||||
dashedName: step-45
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -192,79 +192,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f02bdeb9b428208b97eb6b
|
||||
title: Step 45
|
||||
title: Step 46
|
||||
challengeType: 0
|
||||
dashedName: step-45
|
||||
dashedName: step-46
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -37,7 +37,7 @@ assert.match(afterCalculateTaxes, /amount\s*\*\s*\(\s*this\s*\.\s*taxRate\s*\/\s
|
||||
Your `calculateTaxes` method should return the value of the `taxRate` (divided by 100, to convert it to a percent) multiplied by the `amount` parameter.
|
||||
|
||||
```js
|
||||
assert.equal(cart.calculateTaxes(10), (cart.taxRate / 100) * 10);
|
||||
assert.strictEqual(cart.calculateTaxes(10), (cart.taxRate / 100) * 10);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@@ -209,79 +209,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f02c6e18773921ba50aa53
|
||||
title: Step 46
|
||||
title: Step 47
|
||||
challengeType: 0
|
||||
dashedName: step-46
|
||||
dashedName: step-47
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -203,79 +203,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0311f5ea9382388d6124f
|
||||
title: Step 47
|
||||
title: Step 48
|
||||
challengeType: 0
|
||||
dashedName: step-47
|
||||
dashedName: step-48
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -189,79 +189,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f033fdb1fbcc254999fcc3
|
||||
title: Step 37
|
||||
title: Step 38
|
||||
challengeType: 0
|
||||
dashedName: step-37
|
||||
dashedName: step-38
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -198,79 +198,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f03446c2ed3e264be6c7fc
|
||||
title: Step 38
|
||||
title: Step 39
|
||||
challengeType: 0
|
||||
dashedName: step-38
|
||||
dashedName: step-39
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -192,79 +192,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0348a54a177272071a595
|
||||
title: Step 39
|
||||
title: Step 40
|
||||
challengeType: 0
|
||||
dashedName: step-39
|
||||
dashedName: step-40
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -204,79 +204,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f034d012f74627ce538d3a
|
||||
title: Step 40
|
||||
title: Step 41
|
||||
challengeType: 0
|
||||
dashedName: step-40
|
||||
dashedName: step-41
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -212,79 +212,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f03686c5ea863533ec71f4
|
||||
title: Step 48
|
||||
title: Step 49
|
||||
challengeType: 0
|
||||
dashedName: step-48
|
||||
dashedName: step-49
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -194,79 +194,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f036ec91fdf238c90665f5
|
||||
title: Step 49
|
||||
title: Step 50
|
||||
challengeType: 0
|
||||
dashedName: step-49
|
||||
dashedName: step-50
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -192,79 +192,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0370b340915399d31e5eb
|
||||
title: Step 50
|
||||
title: Step 51
|
||||
challengeType: 0
|
||||
dashedName: step-50
|
||||
dashedName: step-51
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -206,79 +206,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0374d5351223a747c301d
|
||||
title: Step 51
|
||||
title: Step 52
|
||||
challengeType: 0
|
||||
dashedName: step-51
|
||||
dashedName: step-52
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -232,79 +232,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f0378e173e3c3b7638b528
|
||||
title: Step 52
|
||||
title: Step 53
|
||||
challengeType: 0
|
||||
dashedName: step-52
|
||||
dashedName: step-53
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -14,7 +14,7 @@ Finally, return the value of the `total` property. Remember your `this` keyword.
|
||||
Your `calculateTotal` method should return the value of the `total` property.
|
||||
|
||||
```js
|
||||
assert.equal(cart.calculateTotal(), 0);
|
||||
assert.strictEqual(cart.calculateTotal(), 0);
|
||||
cart.addItem(1, products);
|
||||
assert.approximately(cart.calculateTotal(), 14.06, 0.1);
|
||||
```
|
||||
@@ -188,79 +188,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f038a0ae041d3c5b0cdf23
|
||||
title: Step 54
|
||||
title: Step 55
|
||||
challengeType: 0
|
||||
dashedName: step-54
|
||||
dashedName: step-55
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -186,79 +186,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f038e671d3f73d5a041973
|
||||
title: Step 55
|
||||
title: Step 56
|
||||
challengeType: 0
|
||||
dashedName: step-55
|
||||
dashedName: step-56
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -202,79 +202,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f039dbcef7673e4e758fa3
|
||||
title: Step 56
|
||||
title: Step 57
|
||||
challengeType: 0
|
||||
dashedName: step-56
|
||||
dashedName: step-57
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -207,79 +207,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f03a7143a6ef3f7f3344f0
|
||||
title: Step 57
|
||||
title: Step 58
|
||||
challengeType: 0
|
||||
dashedName: step-57
|
||||
dashedName: step-58
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -200,79 +200,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f03ac2b428b2404a5a7518
|
||||
title: Step 58
|
||||
title: Step 59
|
||||
challengeType: 0
|
||||
dashedName: step-58
|
||||
dashedName: step-59
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -186,79 +186,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f03af535682e4138fdb915
|
||||
title: Step 59
|
||||
title: Step 60
|
||||
challengeType: 0
|
||||
dashedName: step-59
|
||||
dashedName: step-60
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -212,79 +212,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f03b1ed5ab15420c057463
|
||||
title: Step 60
|
||||
title: Step 61
|
||||
challengeType: 0
|
||||
dashedName: step-60
|
||||
dashedName: step-61
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -204,79 +204,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
@@ -558,79 +507,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 63f6721d5110af243ef8f3d9
|
||||
title: Step 53
|
||||
title: Step 54
|
||||
challengeType: 0
|
||||
dashedName: step-53
|
||||
dashedName: step-54
|
||||
---
|
||||
|
||||
# --description--
|
||||
@@ -187,79 +187,28 @@ const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
class Dessert {
|
||||
constructor(id, name, price, category) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
const products = [
|
||||
{
|
||||
id: 1,
|
||||
name: "Vanilla Cupcakes (6 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "French Macaron",
|
||||
price: 3.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "Pumpkin Cupcake",
|
||||
price: 3.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "Chocolate Cupcake",
|
||||
price: 5.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "Chocolate Pretzels (4 Pack)",
|
||||
price: 10.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "Strawberry Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "Chocolate Macarons (4 Pack)",
|
||||
price: 9.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "Strawberry Pretzel",
|
||||
price: 4.99,
|
||||
category: "Pretzel",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Butter Pecan Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "Rocky Road Ice Cream",
|
||||
price: 2.99,
|
||||
category: "Ice Cream",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "Vanilla Macarons (5 Pack)",
|
||||
price: 11.99,
|
||||
category: "Macaron",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "Lemon Cupcakes (4 Pack)",
|
||||
price: 12.99,
|
||||
category: "Cupcake",
|
||||
},
|
||||
new Dessert(1, "Vanilla Cupcakes (6 Pack)", 12.99, "Cupcake"),
|
||||
new Dessert(2, "French Macaron", 3.99, "Macaron"),
|
||||
new Dessert(3, "Pumpkin Cupcake", 3.99, "Cupcake"),
|
||||
new Dessert(4, "Chocolate Cupcake", 5.99, "Cupcake"),
|
||||
new Dessert(5, "Chocolate Pretzels (4 Pack)", 10.99, "Pretzel"),
|
||||
new Dessert(6, "Strawberry Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(7, "Chocolate Macarons (4 Pack)", 9.99, "Macaron"),
|
||||
new Dessert(8, "Strawberry Pretzel", 4.99, "Pretzel"),
|
||||
new Dessert(9, "Butter Pecan Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(10, "Rocky Road Ice Cream", 2.99, "Ice Cream"),
|
||||
new Dessert(11, "Vanilla Macarons (5 Pack)", 11.99, "Macaron"),
|
||||
new Dessert(12, "Lemon Cupcakes (4 Pack)", 12.99, "Cupcake"),
|
||||
];
|
||||
|
||||
products.forEach(
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
---
|
||||
id: 69d7d4dc8c6e21a2a19c4d34
|
||||
title: Step 6
|
||||
challengeType: 0
|
||||
dashedName: step-6
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
You are already familiar with an HTML `class`, but JavaScript also has a <dfn>class</dfn>. In JavaScript, a class is like a blueprint for creating objects. It allows you to define a set of properties and methods, and instantiate (or create) new objects with those properties and methods.
|
||||
|
||||
Here is an example of declaring a `Dessert` class:
|
||||
|
||||
```js
|
||||
class Dessert {}
|
||||
```
|
||||
|
||||
Before you start adding products, create a `class` named `Dessert`. Give it a `constructor` that takes four parameters in this order: `id`, `name`, `price`, and `category`. Inside the `constructor`, assign each parameter to a property of the same name on `this`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should declare a class named `Dessert`.
|
||||
|
||||
```js
|
||||
assert.isFunction(Dessert);
|
||||
```
|
||||
|
||||
Your `Dessert` class should have a `constructor` that takes four parameters: `id`, `name`, `price`, and `category`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(Dessert.length, 4);
|
||||
```
|
||||
|
||||
Your `Dessert` constructor should assign each parameter to a property of the same name on `this`.
|
||||
|
||||
```js
|
||||
const d = new Dessert(1, 'Test', 1.99, 'Test Category');
|
||||
assert.strictEqual(d.id, 1);
|
||||
assert.strictEqual(d.name, 'Test');
|
||||
assert.strictEqual(d.price, 1.99);
|
||||
assert.strictEqual(d.category, 'Test Category');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>freeCodeCamp Shopping Cart</title>
|
||||
<link rel="stylesheet" href="./styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1 class="title">Desserts Page</h1>
|
||||
</header>
|
||||
<main>
|
||||
<button id="cart-btn" type="button" class="btn">
|
||||
<span id="show-hide-cart">Show</span> Cart
|
||||
</button>
|
||||
<div id="cart-container">
|
||||
<button class="btn" id="clear-cart-btn">Clear Cart</button>
|
||||
<div id="products-container"></div>
|
||||
<p>Total number of items: <span id="total-items">0</span></p>
|
||||
<p>Subtotal: <span id="subtotal">$0</span></p>
|
||||
<p>Taxes: <span id="taxes">$0</span></p>
|
||||
<p>Total: <span id="total">$0</span></p>
|
||||
</div>
|
||||
<div id="dessert-card-container"></div>
|
||||
</main>
|
||||
<script src="./script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
```css
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:root {
|
||||
--dark-grey: #1b1b32;
|
||||
--light-grey: #f5f6f7;
|
||||
--black: #000;
|
||||
--white: #fff;
|
||||
--grey: #3b3b4f;
|
||||
--golden-yellow: #fecc4c;
|
||||
--yellow: #ffcc4c;
|
||||
--gold: #feac32;
|
||||
--orange: #ffac33;
|
||||
--dark-orange: #f89808;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--dark-grey);
|
||||
}
|
||||
|
||||
.title {
|
||||
color: var(--light-grey);
|
||||
text-align: center;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
#dessert-card-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dessert-card {
|
||||
background-color: var(--light-grey);
|
||||
padding: 15px;
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
margin: 20px 10px;
|
||||
}
|
||||
|
||||
.dessert-price {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
width: 100px;
|
||||
color: var(--dark-grey);
|
||||
background-color: var(--gold);
|
||||
background-image: linear-gradient(var(--golden-yellow), var(--orange));
|
||||
border-color: var(--gold);
|
||||
border-width: 3px;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background-image: linear-gradient(var(--yellow), var(--dark-orange));
|
||||
}
|
||||
|
||||
#cart-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.add-to-cart-btn {
|
||||
margin: 30px auto 10px;
|
||||
}
|
||||
|
||||
#cart-container {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
right: 0;
|
||||
background-color: var(--light-grey);
|
||||
width: 200px;
|
||||
height: 400px;
|
||||
border: 8px double var(--black);
|
||||
border-radius: 15px;
|
||||
text-align: center;
|
||||
font-size: 1.2rem;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.product {
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
.product-count {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.product-category {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
#dessert-card-container {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.dessert-card {
|
||||
flex: 1 0 21%;
|
||||
}
|
||||
|
||||
#cart-container {
|
||||
width: 300px;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
const cartContainer = document.getElementById("cart-container");
|
||||
const productsContainer = document.getElementById("products-container");
|
||||
const dessertCards = document.getElementById("dessert-card-container");
|
||||
const cartBtn = document.getElementById("cart-btn");
|
||||
const clearCartBtn = document.getElementById("clear-cart-btn");
|
||||
const totalNumberOfItems = document.getElementById("total-items");
|
||||
const cartSubTotal = document.getElementById("subtotal");
|
||||
const cartTaxes = document.getElementById("taxes");
|
||||
const cartTotal = document.getElementById("total");
|
||||
const showHideCartSpan = document.getElementById("show-hide-cart");
|
||||
let isCartShowing = false;
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
const products = [];
|
||||
```
|
||||
@@ -6,246 +6,67 @@
|
||||
"hasEditableBoundaries": true,
|
||||
"dashedName": "workshop-shopping-cart",
|
||||
"challengeOrder": [
|
||||
{
|
||||
"id": "63ec14d1c216aa063f0be4af",
|
||||
"title": "Step 1"
|
||||
},
|
||||
{
|
||||
"id": "63ec19978a066607e23439f8",
|
||||
"title": "Step 2"
|
||||
},
|
||||
{
|
||||
"id": "63ec1a16f930b108b8a76806",
|
||||
"title": "Step 3"
|
||||
},
|
||||
{
|
||||
"id": "63ec1bbf5584390a7d08d41f",
|
||||
"title": "Step 4"
|
||||
},
|
||||
{
|
||||
"id": "63ec1cb59f2a4c0be5b6dfa0",
|
||||
"title": "Step 5"
|
||||
},
|
||||
{
|
||||
"id": "63ec20a06fff670d37befbd9",
|
||||
"title": "Step 6"
|
||||
},
|
||||
{
|
||||
"id": "63ec3287b182ec0efe8a3135",
|
||||
"title": "Step 7"
|
||||
},
|
||||
{
|
||||
"id": "63ec3427fc3e9214c9ed2a14",
|
||||
"title": "Step 8"
|
||||
},
|
||||
{
|
||||
"id": "63ec36f6133df7160be3ec66",
|
||||
"title": "Step 9"
|
||||
},
|
||||
{
|
||||
"id": "63ec47b454495519739486a7",
|
||||
"title": "Step 10"
|
||||
},
|
||||
{
|
||||
"id": "63ee5d38a5d29d0696f8d820",
|
||||
"title": "Step 11"
|
||||
},
|
||||
{
|
||||
"id": "63ee5d8f9e7168076e932fe2",
|
||||
"title": "Step 12"
|
||||
},
|
||||
{
|
||||
"id": "63ee5e0f08e82208364c4128",
|
||||
"title": "Step 13"
|
||||
},
|
||||
{
|
||||
"id": "63ee5ea8be892e0955ab346c",
|
||||
"title": "Step 14"
|
||||
},
|
||||
{
|
||||
"id": "63ee5fc113bcb20a5db9214b",
|
||||
"title": "Step 15"
|
||||
},
|
||||
{
|
||||
"id": "63ee611d478dca0b77f6a393",
|
||||
"title": "Step 16"
|
||||
},
|
||||
{
|
||||
"id": "63ee7c664f9b65137d925c8a",
|
||||
"title": "Step 17"
|
||||
},
|
||||
{
|
||||
"id": "63eea5cea403a81a68ae493c",
|
||||
"title": "Step 18"
|
||||
},
|
||||
{
|
||||
"id": "63eea817673c8e1c22927fa6",
|
||||
"title": "Step 19"
|
||||
},
|
||||
{
|
||||
"id": "63eea8e1e143ae1d098c8c9d",
|
||||
"title": "Step 20"
|
||||
},
|
||||
{
|
||||
"id": "63eeb8e86becbf1e75c2cb0d",
|
||||
"title": "Step 21"
|
||||
},
|
||||
{
|
||||
"id": "63eedebb0ec0231ff1cede1a",
|
||||
"title": "Step 22"
|
||||
},
|
||||
{
|
||||
"id": "63efdbc22a0c56070beabed7",
|
||||
"title": "Step 23"
|
||||
},
|
||||
{
|
||||
"id": "63efe370bbfc4a08d500118e",
|
||||
"title": "Step 24"
|
||||
},
|
||||
{
|
||||
"id": "63eff02f00e69a0b2ac10b43",
|
||||
"title": "Step 25"
|
||||
},
|
||||
{
|
||||
"id": "63eff98ffb1d5a0d24ec79cb",
|
||||
"title": "Step 26"
|
||||
},
|
||||
{
|
||||
"id": "63effe558c87a70e7072e447",
|
||||
"title": "Step 27"
|
||||
},
|
||||
{
|
||||
"id": "63f0165121a9181342d5bc66",
|
||||
"title": "Step 28"
|
||||
},
|
||||
{
|
||||
"id": "63f017b4ad028a148eb713c0",
|
||||
"title": "Step 29"
|
||||
},
|
||||
{
|
||||
"id": "63f01861f813e01564c95315",
|
||||
"title": "Step 30"
|
||||
},
|
||||
{
|
||||
"id": "63f018f04e487e164dc27bd9",
|
||||
"title": "Step 31"
|
||||
},
|
||||
{
|
||||
"id": "63f01c9791a0aa1751c73760",
|
||||
"title": "Step 32"
|
||||
},
|
||||
{
|
||||
"id": "63f0224ceb16dc196d2c860a",
|
||||
"title": "Step 33"
|
||||
},
|
||||
{
|
||||
"id": "63f026d041bc6c1a3d5cba0f",
|
||||
"title": "Step 34"
|
||||
},
|
||||
{
|
||||
"id": "63f0284532742c1b26c7a052",
|
||||
"title": "Step 35"
|
||||
},
|
||||
{
|
||||
"id": "63f0289df84a581bbdbd29b7",
|
||||
"title": "Step 36"
|
||||
},
|
||||
{
|
||||
"id": "63f033fdb1fbcc254999fcc3",
|
||||
"title": "Step 37"
|
||||
},
|
||||
{
|
||||
"id": "63f03446c2ed3e264be6c7fc",
|
||||
"title": "Step 38"
|
||||
},
|
||||
{
|
||||
"id": "63f0348a54a177272071a595",
|
||||
"title": "Step 39"
|
||||
},
|
||||
{
|
||||
"id": "63f034d012f74627ce538d3a",
|
||||
"title": "Step 40"
|
||||
},
|
||||
{
|
||||
"id": "63f0295e673b661ccb299e8a",
|
||||
"title": "Step 41"
|
||||
},
|
||||
{
|
||||
"id": "63f029b96b9e9e1df93be951",
|
||||
"title": "Step 42"
|
||||
},
|
||||
{
|
||||
"id": "63f02a4ef92d711ec1ff618c",
|
||||
"title": "Step 43"
|
||||
},
|
||||
{
|
||||
"id": "63f02b22cce1c11fe9604381",
|
||||
"title": "Step 44"
|
||||
},
|
||||
{
|
||||
"id": "63f02bdeb9b428208b97eb6b",
|
||||
"title": "Step 45"
|
||||
},
|
||||
{
|
||||
"id": "63f02c6e18773921ba50aa53",
|
||||
"title": "Step 46"
|
||||
},
|
||||
{
|
||||
"id": "63f0311f5ea9382388d6124f",
|
||||
"title": "Step 47"
|
||||
},
|
||||
{
|
||||
"id": "63f03686c5ea863533ec71f4",
|
||||
"title": "Step 48"
|
||||
},
|
||||
{
|
||||
"id": "63f036ec91fdf238c90665f5",
|
||||
"title": "Step 49"
|
||||
},
|
||||
{
|
||||
"id": "63f0370b340915399d31e5eb",
|
||||
"title": "Step 50"
|
||||
},
|
||||
{
|
||||
"id": "63f0374d5351223a747c301d",
|
||||
"title": "Step 51"
|
||||
},
|
||||
{
|
||||
"id": "63f0378e173e3c3b7638b528",
|
||||
"title": "Step 52"
|
||||
},
|
||||
{
|
||||
"id": "63f6721d5110af243ef8f3d9",
|
||||
"title": "Step 53"
|
||||
},
|
||||
{
|
||||
"id": "63f038a0ae041d3c5b0cdf23",
|
||||
"title": "Step 54"
|
||||
},
|
||||
{
|
||||
"id": "63f038e671d3f73d5a041973",
|
||||
"title": "Step 55"
|
||||
},
|
||||
{
|
||||
"id": "63f039dbcef7673e4e758fa3",
|
||||
"title": "Step 56"
|
||||
},
|
||||
{
|
||||
"id": "63f03a7143a6ef3f7f3344f0",
|
||||
"title": "Step 57"
|
||||
},
|
||||
{
|
||||
"id": "63f03ac2b428b2404a5a7518",
|
||||
"title": "Step 58"
|
||||
},
|
||||
{
|
||||
"id": "63f03af535682e4138fdb915",
|
||||
"title": "Step 59"
|
||||
},
|
||||
{
|
||||
"id": "63f03b1ed5ab15420c057463",
|
||||
"title": "Step 60"
|
||||
}
|
||||
{ "id": "63ec14d1c216aa063f0be4af", "title": "Step 1" },
|
||||
{ "id": "63ec19978a066607e23439f8", "title": "Step 2" },
|
||||
{ "id": "63ec1a16f930b108b8a76806", "title": "Step 3" },
|
||||
{ "id": "63ec1bbf5584390a7d08d41f", "title": "Step 4" },
|
||||
{ "id": "63ec1cb59f2a4c0be5b6dfa0", "title": "Step 5" },
|
||||
{ "id": "69d7d4dc8c6e21a2a19c4d34", "title": "Step 6" },
|
||||
{ "id": "63ec20a06fff670d37befbd9", "title": "Step 7" },
|
||||
{ "id": "63ec3287b182ec0efe8a3135", "title": "Step 8" },
|
||||
{ "id": "63ec3427fc3e9214c9ed2a14", "title": "Step 9" },
|
||||
{ "id": "63ec36f6133df7160be3ec66", "title": "Step 10" },
|
||||
{ "id": "63ec47b454495519739486a7", "title": "Step 11" },
|
||||
{ "id": "63ee5d38a5d29d0696f8d820", "title": "Step 12" },
|
||||
{ "id": "63ee5d8f9e7168076e932fe2", "title": "Step 13" },
|
||||
{ "id": "63ee5e0f08e82208364c4128", "title": "Step 14" },
|
||||
{ "id": "63ee5ea8be892e0955ab346c", "title": "Step 15" },
|
||||
{ "id": "63ee5fc113bcb20a5db9214b", "title": "Step 16" },
|
||||
{ "id": "63ee611d478dca0b77f6a393", "title": "Step 17" },
|
||||
{ "id": "63ee7c664f9b65137d925c8a", "title": "Step 18" },
|
||||
{ "id": "63eea5cea403a81a68ae493c", "title": "Step 19" },
|
||||
{ "id": "63eea817673c8e1c22927fa6", "title": "Step 20" },
|
||||
{ "id": "63eea8e1e143ae1d098c8c9d", "title": "Step 21" },
|
||||
{ "id": "63eeb8e86becbf1e75c2cb0d", "title": "Step 22" },
|
||||
{ "id": "63eedebb0ec0231ff1cede1a", "title": "Step 23" },
|
||||
{ "id": "63efdbc22a0c56070beabed7", "title": "Step 24" },
|
||||
{ "id": "63efe370bbfc4a08d500118e", "title": "Step 25" },
|
||||
{ "id": "63eff02f00e69a0b2ac10b43", "title": "Step 26" },
|
||||
{ "id": "63eff98ffb1d5a0d24ec79cb", "title": "Step 27" },
|
||||
{ "id": "63effe558c87a70e7072e447", "title": "Step 28" },
|
||||
{ "id": "63f0165121a9181342d5bc66", "title": "Step 29" },
|
||||
{ "id": "63f017b4ad028a148eb713c0", "title": "Step 30" },
|
||||
{ "id": "63f01861f813e01564c95315", "title": "Step 31" },
|
||||
{ "id": "63f018f04e487e164dc27bd9", "title": "Step 32" },
|
||||
{ "id": "63f01c9791a0aa1751c73760", "title": "Step 33" },
|
||||
{ "id": "63f0224ceb16dc196d2c860a", "title": "Step 34" },
|
||||
{ "id": "63f026d041bc6c1a3d5cba0f", "title": "Step 35" },
|
||||
{ "id": "63f0284532742c1b26c7a052", "title": "Step 36" },
|
||||
{ "id": "63f0289df84a581bbdbd29b7", "title": "Step 37" },
|
||||
{ "id": "63f033fdb1fbcc254999fcc3", "title": "Step 38" },
|
||||
{ "id": "63f03446c2ed3e264be6c7fc", "title": "Step 39" },
|
||||
{ "id": "63f0348a54a177272071a595", "title": "Step 40" },
|
||||
{ "id": "63f034d012f74627ce538d3a", "title": "Step 41" },
|
||||
{ "id": "63f0295e673b661ccb299e8a", "title": "Step 42" },
|
||||
{ "id": "63f029b96b9e9e1df93be951", "title": "Step 43" },
|
||||
{ "id": "63f02a4ef92d711ec1ff618c", "title": "Step 44" },
|
||||
{ "id": "63f02b22cce1c11fe9604381", "title": "Step 45" },
|
||||
{ "id": "63f02bdeb9b428208b97eb6b", "title": "Step 46" },
|
||||
{ "id": "63f02c6e18773921ba50aa53", "title": "Step 47" },
|
||||
{ "id": "63f0311f5ea9382388d6124f", "title": "Step 48" },
|
||||
{ "id": "63f03686c5ea863533ec71f4", "title": "Step 49" },
|
||||
{ "id": "63f036ec91fdf238c90665f5", "title": "Step 50" },
|
||||
{ "id": "63f0370b340915399d31e5eb", "title": "Step 51" },
|
||||
{ "id": "63f0374d5351223a747c301d", "title": "Step 52" },
|
||||
{ "id": "63f0378e173e3c3b7638b528", "title": "Step 53" },
|
||||
{ "id": "63f6721d5110af243ef8f3d9", "title": "Step 54" },
|
||||
{ "id": "63f038a0ae041d3c5b0cdf23", "title": "Step 55" },
|
||||
{ "id": "63f038e671d3f73d5a041973", "title": "Step 56" },
|
||||
{ "id": "63f039dbcef7673e4e758fa3", "title": "Step 57" },
|
||||
{ "id": "63f03a7143a6ef3f7f3344f0", "title": "Step 58" },
|
||||
{ "id": "63f03ac2b428b2404a5a7518", "title": "Step 59" },
|
||||
{ "id": "63f03af535682e4138fdb915", "title": "Step 60" },
|
||||
{ "id": "63f03b1ed5ab15420c057463", "title": "Step 61" }
|
||||
],
|
||||
"helpCategory": "JavaScript"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user