Basic JavaScript - Counting Cards

Someone please help i can’t seem to find the error in my code

Your code so far

var count = 0;

function cc(card) {
  // Only change code below this line
switch (count) {
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
  case 10:
  case 'J':
  case 'Q':
  case 'K':
  case 'A':
  if (count > 0) {
    return count + "" + 'Bet';
  } else {
    return count + "" + '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 (Linux; Android 8.1.0; Infinix X624 Build/O11019) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.129 Mobile Safari/537.36

Challenge: Basic JavaScript - Counting Cards

Link to the challenge:

You need to switch card not count as you increase or decrease the count based on the card.

There should be a space between count and Bet “” doesnt have a space. It should be " ".
Same with Hold

Okay let me try it out

wow thanks it worked

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