Card counting black jack

Where do i make mistake in the below code ?

var count = 0;

function cc(card) {

  // Only change code below this line

switch(card) {

  case 2:

  case 3:

  case 4:

  case 5:

  case 6:

  count++;

  break;

  case 10:

  case "J":

  case "Q":

  case "K":

  case "A":

  count--;

  break; 

}

var holdbet = "hold"

if(count>0) {

  holdbet = "bet";

}

  return count + " " + holdbet; 

  // Only change code above this line

}

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

Small typo: - isn’t - -

It is important to format your code properly, or it is not possible to see correctly your code, as you can see it can bring people to give the wrong suggestions as what happened with @JeremyLT.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

your return values are 5 bet or -1 hold
how do these differ from what’s asked in the challenge description?

Arg, confounded Markdown :slight_smile: