var count = 0;
function cc(card) {
// Only change code below this line
var co;
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 7:
case 8:
case 9:
count==0;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count--;
break;
}
if(count>0){
co= "Bet";
}
else{
co= "Hold";
}
return count+co;
}
I haven’t tackled this challenge, so if you could explain the objective of the code or the expected outcome of the code then I could help. Nevertheless at case 9: count == 0; I believe should be count = 0 and not count == 0. count == 0 has no effect on the count variable - unless you want a boolean outcome.
the code posted is not resetting count, it’s using a comparison operator not an assignment.
If the space is correctly added it passes, most likey @fccb988c681-323f-44b is not adding the space correctly
Great so i @Dereje1 has pointed out that there should be a space in-between count and co. I guess that’s a requirement of the challenge. You can achieve that with return count+" "+co rather than return count + co
Try it and let’s see
Well, it depends on the perspective you look at it from. I would say yes and no. As an anagram, It would be easier to show someone a banana or an image of a banana than trying to describe a banana with words and more especially when typing.
I think if there are parts of a copy and past code you are not familiar with you could seek further clarification.
What do you think?
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
If you want to compare your solution to others, use the Get a hint button on the challenge and there are alternative solutions you can compare yours to. Also, you can probably search older posts using the forum search feature or google the challenge name and find more there.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.