Tell us what’s happening:
Dear All,
Good nights,
I´m having troubles solving this challenge, would anyone please give me some orientation about how to solve it, i don´t understand basically how to put 5 and Bet together,
i tried to put : result 5 + “Bet”; (but it did not work),
thank you so much in advance to you all,
Kind regards,
Ivonne
Your code so far
var count = 0;
function cc(card) {
// Only change code below this line
if (card >= 2 && card <= 6 ){
count ++;
}
else if (card >= 7 && card <= 9){
count = 0;
}
else if (card == 10 || card == 'J' || card == 'Q'|| card == 'K' || card == 'A'){
count --;
}
if (card >= 2 && card <= 6){
return count;
}
if (count >= 0){
return count + "Bet";
}
else if (count <= 0) {
return count + "Hold" ;
}
else return "Change Me";
}
// Only change code above this line
// Add/remove calls to test your function.
// Note: Only the last will display
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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36.
Dear @Marmiz,
Good mornings,
Thank you so much for your fast reply, i appreciate it, i fixed the problem,
i will be careful with the white spaces in the string concatenation,
I wish you a lovely day @Marmiz,
Kind regards,
Ivonne
Dear @artistpw,
Thank you so much for your help,
i appreciate it,
I wish you a wonderful day, and thank you so much for the orientation,
Kind regards,
Ivonne
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.
I think the cards in that range are just ignored for card counting. You only want to add or subtract from the count with the other ranges of cards. Maybe that will remedy your original coding.