Basic JavaScript - Counting Cards

Tell us what’s happening:
Describe your issue in detail here.
Good day, im new to programming and im trying to learn java script, however the card counting challenge in “freecodecamp” has proven to be diffiult as thought this program does exactly what is requested, i know because ive tested it in another compiler, it will not allow me to proceed to the next challenge because “it doesnt do what its supposed to”. Honestly if someone could just insert my code into the challenge below then into a compiler u’d see that it works. pls help
Your code so far

let count = 0;

function cc(card) {
  // Only change code below this line
if (card > 1 && card < 7){
  count += 1;}
else if (card > 6 && card < 10){
  count += 0}

   case 10:
   case "J":
   case "Q":
   case "K":
   case "A":
   count -= 1;
if (count > 0) {
 return (count + " " + "Bet")
else {
 return (count + " " + "Hold")

  // Only change code above this line

 cc(10); cc("J"); cc("Q"); cc("K"); cc("A");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic JavaScript - Counting Cards

Link to the challenge:

Your formatting is confusing, but the code passes fine for me.

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