Tell us what’s happening:
Here while i code like this,it works and gives me the output.There are 7 examples in task.I can clear all of them using my code that is little bit differ from actual code shown in hint.
The output is exactly same it should be wanted…
Your code so far
var x=0;
var count=0;
function cc(card) {
// Only change code below this line
switch(card){
case 2 : case 3: case 4: case 5: case 6:
count=1;
x=x+count;
break;
case 10:case "J":case "Q":case "K":case "A":
count=-1;
x=x+count;
break;
}
if (x <= 0){
return x+" Hold";
}
else {
return x+ " Bet";
}
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(4); cc(5); cc(6);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0
.
Link to the challenge:
https://www.freecodecamp.org/challenges/counting-cards