From c3523cfe62db28feb2ece688e3af670cb17f69a8 Mon Sep 17 00:00:00 2001 From: Kinjalk Bajpai <34712617+strawHat121@users.noreply.github.com> Date: Mon, 7 Apr 2025 21:17:03 +0530 Subject: [PATCH] fix(curriculum): update getShoppingListMsg function to accept an array parameter (#59253) --- .../66c645b345a39bf04864dc50.md | 15 +++++-- .../66c6491fe4c8e0f16845425f.md | 10 ++--- .../66c64ad16796c7f2419b45c5.md | 8 ++-- .../66c726c34ecf1e238aa9d7d5.md | 8 ++-- .../66c72a55418cc9247b710827.md | 12 +++--- .../66c72b0ffbc5522525768558.md | 10 ++--- .../66c72f4d0528bd268a82107b.md | 14 +++---- .../66c730183f4020275cbf0611.md | 12 +++--- .../66c730ee6ae076281721d0b9.md | 12 +++--- .../66c73a0c5b264f2a75164d94.md | 16 ++++---- .../66c73a7798f6f62b2ae58f22.md | 18 ++++----- .../66c73fa7433e082c4be096b1.md | 16 ++++---- .../66c74079c30b1c2d166cb9a4.md | 16 ++++---- .../66c742d045c9fc2e09fa64b1.md | 16 ++++---- .../66c748ffdfbe4f2ede268be2.md | 40 ++++++++++--------- .../66cbe2319d3845545a293a0b.md | 8 ++-- 16 files changed, 120 insertions(+), 111 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c645b345a39bf04864dc50.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c645b345a39bf04864dc50.md index fc5f0251880..489112427c8 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c645b345a39bf04864dc50.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c645b345a39bf04864dc50.md @@ -11,7 +11,7 @@ To see the updated shopping list, you will need to log the current shopping list Since this message will be used repeatedly throughout the workshop, it is best to create a reusable function. -Create a function called `getShoppingListMsg` that returns the string `"Current Shopping List: "` followed by the `shoppingList` array. +Create a function called `getShoppingListMsg` that takes an array as a parameter and returns the string `"Current Shopping List: "` followed by the contents of the provided array. You can use template literals or string concatenation with the `+` operator to combine the string and the `shoppingList` array. @@ -26,13 +26,20 @@ assert.isFunction(getShoppingListMsg); Your `getShoppingListMsg` function should return a string. ```js -assert.isString(getShoppingListMsg()); +assert.isString(getShoppingListMsg(shoppingList)); ``` -Your `getShoppingListMsg` function should return the message of `"Current Shopping List: "` followed by the `shoppingList` array. Double check spacing and spelling errors. +Your `getShoppingListMsg` function should accept an array as an argument. + ```js -assert.strictEqual(getShoppingListMsg(), "Current Shopping List: Apples"); +assert.strictEqual(getShoppingListMsg(["Anchovies", "Olives"]), "Current Shopping List: Anchovies,Olives"); +``` + +Your `getShoppingListMsg` function should accept an array and return the message `"Current Shopping List: "` followed by the contents of that array. Double check spacing and spelling errors. + +```js +assert.strictEqual(getShoppingListMsg(["Apples"]), "Current Shopping List: Apples"); ``` # --seed-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c6491fe4c8e0f16845425f.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c6491fe4c8e0f16845425f.md index 8b8b7e314d2..33453d2ad5b 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c6491fe4c8e0f16845425f.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c6491fe4c8e0f16845425f.md @@ -27,10 +27,10 @@ Your `shoppingList` array should contain the string `"Grapes"`. assert.equal(shoppingList[1], "Grapes"); ``` -You should call the `getShoppingListMsg` function inside of the `console.log`. +You should call `getShoppingListMsg(shoppingList)` function inside of the `console.log`. ```js -assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\)\s*\)/g), 2); +assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\s*shoppingList\s*\)\s*\)/g), 2); ``` # --seed-- @@ -46,11 +46,11 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); --fcc-editable-region-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c64ad16796c7f2419b45c5.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c64ad16796c7f2419b45c5.md index 038798eee2d..1a53334e2c2 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c64ad16796c7f2419b45c5.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c64ad16796c7f2419b45c5.md @@ -32,14 +32,14 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); --fcc-editable-region-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c726c34ecf1e238aa9d7d5.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c726c34ecf1e238aa9d7d5.md index 3723e9eef15..f3d4903dd5f 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c726c34ecf1e238aa9d7d5.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c726c34ecf1e238aa9d7d5.md @@ -43,14 +43,14 @@ const shoppingList = []; console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72a55418cc9247b710827.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72a55418cc9247b710827.md index 9e00a390df8..e9150f82c1d 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72a55418cc9247b710827.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72a55418cc9247b710827.md @@ -11,10 +11,10 @@ Next, add a `console.log` and call the `getShoppingListMsg` function inside of t # --hints-- -You should call the `getShoppingListMsg` function inside of the `console.log`. +You should call `getShoppingListMsg(shoppingList)` inside of the `console.log`. ```js -assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\)\s*\)/g), 3); +assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\s*shoppingList\s*\)\s*\)/g), 3); ``` # --seed-- @@ -30,14 +30,14 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72b0ffbc5522525768558.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72b0ffbc5522525768558.md index 9fd6a0c1ae9..34368b46dc0 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72b0ffbc5522525768558.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72b0ffbc5522525768558.md @@ -58,19 +58,19 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); --fcc-editable-region-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72f4d0528bd268a82107b.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72f4d0528bd268a82107b.md index c1358ed68d8..5b68a2e6fbf 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72f4d0528bd268a82107b.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c72f4d0528bd268a82107b.md @@ -13,10 +13,10 @@ Add another `console.log` and call the `getShoppingListMsg` function inside of t # --hints-- -You should call the `getShoppingListMsg` function inside of the `console.log`. +You should call `getShoppingListMsg(shoppingList)` inside of the `console.log`. ```js -assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\)\s*\)/g), 4); +assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\s*shoppingList\s*\)\s*\)/g), 4); ``` # --seed-- @@ -32,19 +32,19 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730183f4020275cbf0611.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730183f4020275cbf0611.md index 292666b6b82..03fc3f0a335 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730183f4020275cbf0611.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730183f4020275cbf0611.md @@ -32,22 +32,22 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); --fcc-editable-region-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730ee6ae076281721d0b9.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730ee6ae076281721d0b9.md index 39d5964e449..a3a2c2ff83a 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730ee6ae076281721d0b9.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c730ee6ae076281721d0b9.md @@ -48,22 +48,22 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a0c5b264f2a75164d94.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a0c5b264f2a75164d94.md index 3d5e4416b6b..d1807498d39 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a0c5b264f2a75164d94.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a0c5b264f2a75164d94.md @@ -13,10 +13,10 @@ Add a `console.log` and call the `getShoppingListMsg` function inside of the `co # --hints-- -You should call the `getShoppingListMsg` function inside of the `console.log`. +You should call `getShoppingListMsg(shoppingList)` inside of the `console.log`. ```js -assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\)\s*\)/g), 5); +assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\s*shoppingList\s*\)\s*\)/g), 5); ``` # --seed-- @@ -32,22 +32,22 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a7798f6f62b2ae58f22.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a7798f6f62b2ae58f22.md index 89d37ed214f..ff4184f698b 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a7798f6f62b2ae58f22.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73a7798f6f62b2ae58f22.md @@ -35,10 +35,10 @@ You should use the `unshift` method to add the string `"Chocolate Cake"` to the assert.strictEqual(shoppingList[0], "Chocolate Cake"); ``` -You should call the `getShoppingListMsg` function inside of the `console.log`. +You should call `getShoppingListMsg(shoppingList)` inside of the `console.log`. ```js -assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\)\s*\)/g), 6); +assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\s*shoppingList\s*\)\s*\)/g), 6); ``` # --seed-- @@ -54,27 +54,27 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); shoppingList.pop(); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); --fcc-editable-region-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73fa7433e082c4be096b1.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73fa7433e082c4be096b1.md index e42aff25fe2..1516fdd29ef 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73fa7433e082c4be096b1.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c73fa7433e082c4be096b1.md @@ -32,32 +32,32 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); shoppingList.pop(); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It might be nice to get a dessert."); shoppingList.unshift("Chocolate Cake"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); --fcc-editable-region-- diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c74079c30b1c2d166cb9a4.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c74079c30b1c2d166cb9a4.md index 71d5613474c..75ad89b739b 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c74079c30b1c2d166cb9a4.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c74079c30b1c2d166cb9a4.md @@ -48,32 +48,32 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); shoppingList.pop(); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It might be nice to get a dessert."); shoppingList.unshift("Chocolate Cake"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("On second thought, maybe we should be more health conscious."); diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c742d045c9fc2e09fa64b1.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c742d045c9fc2e09fa64b1.md index 2356b3a130d..e5923f64844 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c742d045c9fc2e09fa64b1.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c742d045c9fc2e09fa64b1.md @@ -45,32 +45,32 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); shoppingList.pop(); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It might be nice to get a dessert."); shoppingList.unshift("Chocolate Cake"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("On second thought, maybe we should be more health conscious."); diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c748ffdfbe4f2ede268be2.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c748ffdfbe4f2ede268be2.md index 6ba7f7fffa3..034c36ae35f 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c748ffdfbe4f2ede268be2.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66c748ffdfbe4f2ede268be2.md @@ -9,14 +9,16 @@ dashedName: step-20 In this final step of the workshop, log the final grocery list to the console. +To do this, call the `getShoppingListMsg` function with the `shoppingList` array as an argument inside `console.log`. + And with this last step your grocery list is complete! # --hints-- -You should call the `getShoppingListMsg` function inside of the `console.log`. +You should call `getShoppingListMsg(shoppingList)` inside of the `console.log`. ```js -assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\)\s*\)/g), 7); +assert.lengthOf(code.match(/console\.log\(\s*getShoppingListMsg\(\s*shoppingList\s*\)\s*\)/g), 7); ``` # --seed-- @@ -32,32 +34,32 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); shoppingList.pop(); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It might be nice to get a dessert."); shoppingList.unshift("Chocolate Cake"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("On second thought, maybe we should be more health conscious."); @@ -80,37 +82,37 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Grapes"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It looks like we need to get some cooking oil."); shoppingList.unshift("Vegetable Oil"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); shoppingList.push("Popcorn", "Beef Jerky", "Potato Chips"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("This looks like too much junk food."); shoppingList.pop(); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("It might be nice to get a dessert."); shoppingList.unshift("Chocolate Cake"); -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); console.log("On second thought, maybe we should be more health conscious."); shoppingList.shift(); shoppingList[0] = "Canola Oil"; -console.log(getShoppingListMsg()); +console.log(getShoppingListMsg(shoppingList)); ``` diff --git a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66cbe2319d3845545a293a0b.md b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66cbe2319d3845545a293a0b.md index 5e33eb77bdc..69c8ef4492f 100644 --- a/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66cbe2319d3845545a293a0b.md +++ b/curriculum/challenges/english/25-front-end-development/workshop-shopping-list/66cbe2319d3845545a293a0b.md @@ -13,10 +13,10 @@ Add a `console.log` and call the `getShoppingListMsg` function inside of the `co # --hints-- -You should call the `getShoppingListMsg` function inside of the `console.log`. +You should call the `getShoppingListMsg(shoppingList)` function inside of the `console.log`. ```js -assert.match(code, /console\.log\(\s*getShoppingListMsg\(\)\s*\)/); +assert.match(code, /console\.log\(\s*getShoppingListMsg\(\s*shoppingList\s*\)\s*\)/); ``` # --seed-- @@ -32,8 +32,8 @@ console.log("It will be nice to have some fruit to eat."); shoppingList.push("Apples"); -function getShoppingListMsg() { - return `Current Shopping List: ${shoppingList}`; +function getShoppingListMsg(arr) { + return `Current Shopping List: ${arr}`; } --fcc-editable-region--