Tell us what’s happening:
I have been tackling this challenge for a few hours and I can’t get why it does not accept the following conditions:
Cards Sequence 10, J, Q, K, A should return -5 Hold
Cards Sequence 3, 7, Q, 8, A should return -1 Hold
Cards Sequence 3, 2, A, 10, K should return -1 Hold
Your code so far
var count = 0;
var answer = ''
function cc(card) {
// Only change code below this line
if (card >=2 && card <=6) {
count = count + 1 ;
}
else if (card >= 7 && card <= 9) {
count = count + 0 ;
}
else if ( card == 10||'J'||'Q'||'K'||'A') {
count = count - 1 ;
}
if (count > 0) {
answer = (count) + " Bet";
} else if (count === 0) {
answer = (count) + " Hold";
}
else if (count <= 0) {
answer = (count) + 'Hold';
}
return answer;
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(10); cc("J"); cc("Q"); cc("K"); cc("A");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge: