No matter what some part of the code becomes unreachable

CC2 was unreachable though all others were fine, played with braces and sorted that issue out now the final return count is unreachable, what am i doing wrong?

  **Your code so far**

let count = 0;

function cc (card) 
Switch(card) {
 case 2:
 case 3:
 case 4:
 case 5:
 case 6:
 count++;
break;
case 10:
case'J':
case'Q':
case'K':
case'A':
count--;
break;
}

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



cc(2); cc(3); cc(7); cc('K'); cc('A');
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0

Challenge: Counting Cards

Link to the challenge:

I have it on good authority that the switch statement is not capitalize. You have also removed some very important syntax from your code.

I recommend you click the “Reset All Code” button to start this challenge over fresh and only add/change code in between the comments.

Yeah im just an idiot lol, missed some important syntax tbh i thought the else if statement would take care of the >= part

I suspect that the important syntax that @bbsmooth was referring to is the { at the start of your function block.

2 Likes

This typo is also a problem.

Thank you, I figured it out a few days ago after the first poster mentioned important syntax missing. I’m taking a break and using another site for abit in hope that it clarifies better or that I get a better understanding of the language/syntax to solve the problems.

Good job working through the problem! Happy coding.

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