Why we are calling the function multiple times before calling it in console.log? and how the outer ones called have an effect on the answer when they are not logged on console?
var count = '';
function cc(card) {
switch (card) {
case 2:
case 3:
case 4:
case 5: /* case 2-6 increment count*/
case 6: /* in case 789 nothing will happen */
count++;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count--;
break;
}
var holdbet = 'Hold';
if (count > 0) {
holdbet = 'Bet';
}
return count + ' ' + holdbet;
}
cc(2); cc(4); cc(3); cc('K'); cc('A');
console.log(cc(1));