Tell us what’s happening:
Hello,
I do not understand how your input gets into the program because I am only provided with card
variable both in the function ( the part which I am not supposed to change) and in the part where you check the code:
cc(2); cc(3); cc(7); cc('K'); cc('A');
My output for these values are as follows:
1 Bet
2 Bet
2 Bet
1 Bet
0 Hold
because my code only expects one value, and of course the error message appears from your site (I cannot input all the messages because the character limit is reached):
Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet
which tells me that your input is an array?
So to make this short, my question is how does your input look like? I expected cc(2)
to be just that, not cc(2,3,4,5,6)
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if (card<=6 && card >=2){
count+=1;
}
else if(card>=7 && card<=9){
count+=0;
}
else {
count-=1;
}
if (count>0){
return count+"Bet";
}
else if (count<=0){
return count+"Hold";
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
.
Challenge: Counting Cards
Link to the challenge: