I am not understand with between these code below what is the difference between these?
First system is working well that is commented and the another system that is not commented what is the problem?
thank you for your help.
var count = 0;
function cc(card) {
// Only change code below this line
// First system
// switch (card) {
// case 2:
// case 3:
// case 4:
// case 5:
// case 6:
// count++;
// break;
// case 10:
// case "J":
// case "K":
// case "Q":
// case "A":
// count--;
// break;
// case 7:
// case 8:
// case 9:
// count = count;
// break;
// }
// if (count > 0 && count < 7) {
// return count + " Bet";
// } else if (count == 0) {
// return count + " Hold";
// } else {
// return count + " Hold";
// }
// Second system
if (card >= 2 && card <= 6) {
count++;
if (count > 0 && count < 7) {
return count + " Bet";
}
} else if (card == 10 || card == "A" || card == "K" || card == "Q" || card == "J") {
count--;
if (count < 0) {
return count + " Hold";
}
} else {
switch (card) {
case 7:
case 8:
case 9:
count = count;
return count + " Hold";
}
}
return "Change Me";
// 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');