Basic JavaScript - Counting Cards

Tell us what’s happening:

Describe your issue in detail here.
for some reason my code dosent seem to be working but as far as I’m sure it should be.
I made a list of the all the important values, and checked if the card was in those lists. Then checked the count to return advice on the cards. am I being silly?

Your code so far

let count = 0;

function cc(card) {
  // Only change code below this line
  const plusOne = [2,3,4,5,6];
  const minusOne = [10,'J','K','Q', 'K', 'A'];
  
  if (plusOne.includes(card)){
    count++;
  }
  else if (minusOne.includes(card)){
    count--;
  }

  if (count > 0){
    return count + "Bet";
  }
  else if(count <= 0){
    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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15

Challenge Information:

Basic JavaScript - Counting Cards

Add a console log to look at your return value. It’s missing one character.

what does this mean sorry,

Have you used console.log() before?

You should use console.log to look at what your function returns here

oh I’m such a numpty, thank you anyways

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