Build a Card Counting Assistant - Build a Card Counting Assistant

Tell us what’s happening:

I am correct for the first 2 quests but all the rest are wrong. Can anyone see where my mistake is please.

Your code so far

let count = 0;
function cardCounter(card) {
  switch (card) {
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    count++;
    break;

    case 7:
    case 8:
    case 9:
    break;
    
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
    count--;
    break;
  }
  if(count > 0) {
    return `${count} bet.`;
  } else {
    return `${count} hold.`
  }
}
console.log(cardCounter(2));
console.log(cardCounter(3));
console.log(cardCounter(4));
console.log(cardCounter(5));
console.log(cardCounter(6));
console.log(cardCounter(7));
console.log(cardCounter(8));
console.log(cardCounter(9));
console.log(cardCounter(10));
console.log(cardCounter("J"));
console.log(cardCounter("Q"));
console.log(cardCounter("K"));
console.log(cardCounter("A"));

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36

Challenge Information:

Build a Card Counting Assistant - Build a Card Counting Assistant

1 Like

Thanks let me check on that.

1 Like