# Counting Cards ununderstood

Counting Cards ununderstood
0

#1

Tell us what’s happening:

``````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 +=1;
return "\"" + count*card + " Bet\"";
case 7:
case 8:
case 9:
return "\"" + 0 + " Hold\"";
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count -= 1;
return "\"" + count + " Bet\"";
}

// Only change code above this line
}

// Note: Only the last will display
cc('Q');
``````

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 10.0; WOW64; rv:57.0) Gecko/20100101 Firefox/57.0`.

#2

The returned string shouldn’t have literal double quotes in them. The example output have double quotes to tell you that the expected output are strings.

Your code is also returning early. It should add or subtract from `count` depending on the input, and after that you’ll determine if `count` is positive or negative.

#3

still complain
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 +=1;
return count + " Bet";
case 7:
case 8:
case 9:

``````  return 0 + " Hold";
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count -= 1;
return  count + " Hold";
``````

}

// Only change code above this line
}

// Note: Only the last will display
cc(10);

#4

You’re not supposed to return “Bet” if the count increases or “Hold” if the count decreases. You need to check if `count` is positive. If it is, return the “Bet” string. Otherwise return the “Hold” string.

#5

the still dosen’t work

#6

Can you show me your code so far?

#7
``````var count = 0;

function cc(card) {
// Only change code below this line

if(card >= 2 && card <=6){
count +=1;
return count + " Bet";
}
else if(card >=7 && card <=9){
return count + " Hold";
}else if(card ==10 || card == 'Q' || card== 'J' || card == 'K' || card =='A'){
count -=1;
return count + " Hold";
} // Only change code above this line
}