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();