Please what’s going on guys, this code is supposed to work and let me pass the counting cards level, i have been trying both with switch() statement and it still doesn’t works
My code so far
var count = 0;
function cc(card) {
// Only change code below this line
var regEx = /[JQKA]/;
if(card > 1 && card < 7) {
count++;
} else if(card === 10 || String(card).match(regEx) {
count--;
}
if(card > 0) {
count++;
return count + "Bet";
} else {
return count + "Hold";
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');
This is the link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards/