Counting Cards Help needed, just curious

Tell us what’s happening:
I was just wandering why my code (as seen below) won’t pass as being correct. It passes all 7 tests given.

Your code so far


var count = 0;

function cc(card) {
  // Only change code below this line
  if (card >=2&& card<=6){
    count++;
  } else if (card>=7 && card<=9){
    count;
  } else {
    count--;
  }
  if (count > 0){
    return (count + " bet");
  } else {
    return (count +  " hold");
  }
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); console.log(cc(6));

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards

Are you sure it passes the tests? the strings 5 Bet and 5 bet are two completely different things

This can also be achieved with a switch

switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++
break;

and so on

ha, are you kidding me, I totally missed that one, I did all the same combinations and all of them are correct.
.
.
except for the capital B and H
:joy::joy::joy:

thanx

It passed this time with the B and H

Thanx for the reply, I know that works as well, but I was absolutely sure my way worked as well, and it turns out it works after I changed bet and hold to Bet and Hold :smile::rofl: