Build a Card Counting Assistant - Build a Card Counting Assistant

Tell us what’s happening:

// running tests

  1. You should use let to declare a global variable named count and set it to 0.
    // tests completed

this message is being returned despite complying with all other conditions. i’m also declaring the global variable named count and set it to 0.

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 += 1;
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count -= 1;
  }

  if (count > 0) {
    return count + " Bet";
  } else {
    return count + " Hold";
  }
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36

Challenge Information:

Build a Card Counting Assistant - Build a Card Counting Assistant

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-counting-cards/68a23004e96a105df3a21fc4.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @ryanothelo

Your solution works from my end. Please try one of the following steps to move forward.

Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.

or - Try the step in incognito or private mode.

or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.

or - Ensure your browser is up-to-date or try a different browser.

I hope one of these will work for you.

Happy coding