here is my code, i have not understand what was did i wrong here!
please help me out from this one.
with explanation.
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;
break;
case 7:
case 8:
case 9:
count += 0;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count -= 1;
break;
}
return count + (count > 0 ? "Bet" : "Hold");
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).
Hi @hsurwase !
I edited your post to include the challenge link.
You have a spacing issue.
Add this console.log(count + (count > 0 ? "Bet" : "Hold")) right above the return statement and you will see what I mean.
Hi @jwilkins.oboe
I understand, I need to put a space between the count and bet.
I’m trying to space between them but fail
Did you also add a space between count and hold?
No,
console.log((count + (count > 0 ? " Bet " : " Hold ")))
```Preformatted text
You don’t need to add a space at the end of Bet or Hold.
You just need to add a space before the words.
Also, make sure you are adding those space to the return statement too.
Yes, it worked…
thanks you…