Basic JavaScript - Counting Cards

Tell us what’s happening:
Not sure what I’m doing wrong here

Your code so far

let count = 0;

function cc(card) {
  // Only change code below this line
  switch (card) {
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    case 10 :
  if (count > 0) {
    return " Bet";
    }  else {
      return " Hold";

  // 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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic JavaScript - Counting Cards

Link to the challenge:

Take a closer look at what is returned by function. String is expected to contain the current count, along the Bet or Hold.

I can’t tell what it’s returning. The console says “Your function should return a value for count and the text (Bet or Hold with one space character between them.)”

Try for example: console.log(cc(2))

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