This is my working code that produces the correct output in a separate IDE. When I format it to use returns instead of console.log I can’t seem to pass this challenge. Any help out there?
//Make a card counting system that logs Bet or Hold depending on whether the numbers are positive or negative
var count = 0;
function cardCounter(card) {
switch(card){
// These numbers increment count by 1
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
// These numbers do not increment count
case 7:
case 8:
case 9:
count += 0;
break;
// These numbers decrement count by 1
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count -= 1;
break;
default:
console.log("I dont know what the hell it was");
}
// This tests the condition of count to see whether the numbers stored in the count variable are positive or negative. Positive results in "Bet" negative results in "Hold", 0 also results in "Hold".
}
cardCounter(7);
cardCounter(8);
cardCounter(9);
//cardCounter(5);
//cardCounter(6);
var betOrHold = function(count){
if (count >= 1) {
console.log(count + " Bet");
} else if (count <= 0) {
console.log(count + " Hold");
} else {
console.log("Kill Yourself");
}
}
betOrHold(count);