Why excluding 7, 8 ,9

Tell us what’s happening:
Describe your issue in detail here.

In this challenge, I checked hint (solution1).
why are we excluding 7, 8, and 9 from the case
Your code so far

var count = 0;

function cc(card) {
// Only change code below this line

return "Change Me";
// Only change code above this line

cc(2); cc(3); cc(7); cc('K'); cc('A');
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36

Challenge: Counting Cards

Link to the challenge:

because 7,8,9 do not affect the count in any way, so including code to account for those numbers would just be redundant code.

Count Change is 0 for cards 7, 8 and 9.

So, in our switch statement adding cases for these cards will not the change the value of the count variable since adding or subtracting zero from a number will give you the exact same number.

The value of the count variable is only changing for the cards with +1 or -1 Count Change.

That’s why, we can discard these cases from our switch statement.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.