Hey guys, I need help. I can’t figure out how to keep the count counting with every call, instead I’ve only figured out a way to return the value and player decision of a single callback.
am I close to the solution? or should I try a different approach? maybe a switch case? idk. please any feedback would be great.
var count = 0;
function cc(card) {
// Only change code below this line
var bet = ' Bet';
var hold = ' Hold';
if (card >= 2 && card <= 6) {
count = (count + 1) + bet;
return count;
} else if (card >= 7 && card <= 9) {
count = count + hold;
return count;
} else if (card === 10 || card === 'J' || card === 'Q' || card === 'K' || card === 'A') {
(count - 1) + hold;
return count;
}
return count
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
console.log(cc(2)); cc(3); cc(7); cc('K'); cc('A');