I know i can write my code in a concise way but i cannot understand why a few requirements of my test are failing. For example:
Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet
The issue i’m having is that 2 of the requirement are running well so i’m unsure of what the issue is.
Here are the 2 requirements that have passed
- Cards Sequence 2, J, 9, 2, 7 should return
1 Bet
- Cards Sequence 2, 2, 10 should return
1 Bet
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if (card = 2,3,4,5,6){
count = +1
}else if (card = 7,8,9){
count = +0
} else if (card = 10,'J','Q','K','A'){
count = -1
}
if (count = 1,2,3,4,5){
return count + " Bet"
} else if (count = 0, -1, -2, -3, -4, -5){
return count + " Hold"
}
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards