From 6a54ec762cf272af613b50c7bf23626265ba8ba3 Mon Sep 17 00:00:00 2001 From: James Hall Date: Thu, 5 Jan 2023 09:46:08 -0600 Subject: [PATCH] cleanup --- js-jest/src/gilded_rose.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js-jest/src/gilded_rose.js b/js-jest/src/gilded_rose.js index 91719489..9988ee79 100644 --- a/js-jest/src/gilded_rose.js +++ b/js-jest/src/gilded_rose.js @@ -5,7 +5,7 @@ class Item { this.quality = quality; } } -// TODO: You just started using the switch statement and increment variables. Uncomment the bottom code and run the tests to see the last working version. + class Shop { constructor(items=[]){ this.items = items; @@ -29,15 +29,14 @@ class Shop { itemSellIn-- break; case 'Backstage passes to a TAFKAL80ETC concert': - let daysLeft = this.items[i].sellIn switch (true) { - case (daysLeft < 0): + case (itemSellIn < 0): itemQuality = 0 break; - case (daysLeft <= 5): + case (itemSellIn <= 5): itemQuality += 3 break; - case (daysLeft <= 10): + case (itemSellIn <= 10): itemQuality += 2 break; default: