I chose to make variables with an array of the possible card outcomes.
I know there is a lot of unnecessary work in here but I’m sure i’m missing something big that needs reworked.
**Your code so far**
let count = 0;
function cc(card) {
// Only change code below this line
let addOne = [2, 3, 4, 5, 6];
let addZero = [7, 8, 9];
let subtractOne = [10, "J", "Q", "K", "A"];
if (card == addOne){
count++;
} else if (card == addZero){
count;
}else if (card == subtractOne){
count--;
}
if (count <= 0){
return count + " Hold"
}else{
return count + " Bet"
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');
Challenge: Basic JavaScript - Counting Cards
Link to the challenge: