Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
var count = 0;
function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count = count + 1;
return count;
case 7:
case 8:
case 9:
return count;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count = count -1;
return count;
}
}
cc(3); cc(7); cc('Q');cc(8);cc('A');
if (count<=0){
console.log(count," Hold");
}
else{
console.log(count," Bet");
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Remove return because that exits the function with that return value
Use break to end the switch
This is not very important, but you can use the increment operator to update the value of count i.e count++, and count–, or count+=1 and count-=1.
Out of the switch, you need some condition. This a basic example of a switch using break:
function example(val){
switch(val){
case 1:
val++
break
case 2:
val+=2
break
}
return val
/*return val>1? 'may be 2':'it is one!' (example w cond.)*/
}