From e9e80a7acb07aa03229fa1f30438baf78957f5ff Mon Sep 17 00:00:00 2001 From: Ketan Sahu <120404520+ketansahugit@users.noreply.github.com> Date: Sun, 14 Jan 2024 13:00:28 +0530 Subject: [PATCH] fix(curriculum): typo - replaced data with dessert (#53172) --- .../63efe370bbfc4a08d500118e.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md index cba3963dbee..c2bf4c4c392 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md @@ -9,11 +9,11 @@ dashedName: step-24 You now have a small bug. When you try to access a property of an object and the property doesn't exist, you get `undefined`. This means if the dessert isn't already present in the `totalCountPerProduct` object, you end up trying to add `1` to `undefined`, which results in `NaN`. -To fix this, you can use the `||` operator to set the value to `0` if it doesn't exist. Wrap your right-hand `totalCountPerProduct[data.id]` in parentheses, and add `|| 0` to the end of the expression. +To fix this, you can use the `||` operator to set the value to `0` if it doesn't exist. Wrap your right-hand `totalCountPerProduct[dessert.id]` in parentheses, and add `|| 0` to the end of the expression. # --hints-- -You should wrap your right-hand `totalCountPerProduct[data.id]` in parentheses. +You should wrap your right-hand `totalCountPerProduct[dessert.id]` in parentheses. ```js const cart = new ShoppingCart();