Kindly Help please... what is going on here... i have just two more to pass(Counting Cards)

1… Cards Sequence 2, J, 9, 2, 7 should return 1 Bet
2…Cards Sequence 2, 2, 10 should return 1 Bet

var count = 0;

function cc(card) {
  // Only change code below this line
  if(card > 1 && card < 7) {
    return ++count + " " + "Bet";
  } else if (card < 10) {
    return count + " " + "Hold";
  } 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(7); cc('K'); cc('A');

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

Are you supposed to immediately “Bet” after you count up? Or are you supposed to “Bet” if your count is positive? Same with “Holding”.

1 Like

I am to Bet if the count is positive please…
and Hold when it’s negative or zero;

Ok. Then you’ll need to redo your code, because as it is right now, you immediately “Bet” when you have a “count up” card. @camperextraordinaire highlights what you should probably do.

1 Like

Thanks to You all guys, i used switch instead and it worked. God bless you all for the support.

1 Like