Counting Cards?

Counting Cards?
0

#1

Tell us what’s happening:

Your code so far

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card === )
  return "Change Me";
  // 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');

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:

if cc(3) how it can return “5 Bet” and return “-1 Hold” ???


#2

In the following test case (same as the one shown in your code above), each of these is ran consecutively, so after cc(2), it would return “1 Bet”, then after cc(3); it would return “2 Bet”, then after cc(7); it would return “2 Bet”, then after cc(‘K’), it would return “1 Bet”, and finally after cc(‘K’); it would return “0 Hold”

TEST CASE

cc(2); cc(3); cc(7); cc('K'); cc('A');

The above is the same as writing:

cc(2); // returns "1 Bet"
cc(3); // returns "2 Bet"
cc(7); // returns "2 Bet"
cc('K'); // returns "1 Bet"
cc('A'); // returns "0 Hold"