Tell us what’s happening:
I solved Counting Cards by if/else syntex, however Hint shows answer with switch.
I really wonder which is better as efficiency to choose between if and switch?
If we assume Counting cards as real project in professional world, which one btw if and switch programmers would choose?
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if (card == 2 || card == 3 || card == 4 || card == 5 || card == 6 ) {
count += 1;
} else if (card == 7 || card == 8 || card == 9) {
count += 0;
} else if (card == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A') {
count -= 1;
}
if (count > 0) {
return count + " Bet";
} return count + " Hold";
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(2); cc(10); ```
**Your browser information:**
Your Browser User Agent is: ```Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36```.
**Link to the challenge:**
https://www.freecodecamp.org/challenges/counting-cards