I am not sure if this is going to the forum again. I tried to post it once but I could not find it. I don’t know whats going wrong. Am I using the ++ signs incorectly cos that is where it says unexpected token?
oh now I think I just have to finnish the thing. Thank you a million for helping me. I’ll be back if I still manage to mess it up. But thank you a lot for that. It really made me understand functions better.
boy was I wrong. I mean you did help me figure out the end of a function and more of how the function works. And I will be for ever grateful for that but my code is still not working. It is finally giving me something but it is only telling me to hold.
I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add the backticks.
can you point out why one of these work and the other does not? I found a problem on the hints section that I could get working with deleting a part but my version is still not working.
Not Working
```let count = 0
function cardCounter(card) {
if (card === 2 || card === 3 || card === 4 || card === 5 || card === 6) {
count++;
}
else if (card === 10 || card === "J" || card === "Q" || card === "K" || card === "A") {
count--;
}
if (count < 0) {
return `${count}` + " Bet";
}
else if (count <= 0) {
return `${count}`+ " Hold";
}
}
```
let count=0;
function cardCounter(card)
{
if(card === 2 || card === 3 || card === 4 || card === 5 || card === 6)
{
count ++;
}
else if(card==10|| card=="J"|| card=="Q"|| card=="K"|| card=="A")
{
count--;
}
if (count > 0) {
return `${count}` + " Bet";
} else if (count <= 0){
return `${count}` + " Hold";
}
}``` Working. Also I dont know if I'm using this the right way.
For some reason I cant find the major difference why the other keeps not working.