I have tried this in many different ways…they are starting to scramble my brain. Can someone please help me. What I have now is word by word how it is on the help video…and still its wrong.
Your code so far
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++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}
var holdbet = "Hold"
if ( count > 0) {
holdbet = "Bet"
}
return count + "" + holdbet;
// 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 Edg/83.0.478.61.
When I make that change, your code passes for me. Can you post your full code?
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.
type or paste code here
```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++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}
if (count > 0) {
return count + "Bet";
} else {
return count + "Hold";
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');
I don’t understand. My first code had a completely different end and you said I had missing space. It was exactly like the watch video hint. So I chanced it to be be exactly like the hint version…neither are working. I cant understand it. The tree that are now the if statement are completely that same. I don’t see the spaces. Please help.
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++;
break;
case 10:
case "J":
case "Q":
case "K":
case "A":
count--;
break;
}
var holdbet = "Hold"
if (count > 0) {
holdbet = "Bet"
}
return count + "" + holdbet;
}
// Only change code above this line
}
cc(2); cc(3); cc(7); cc('K'); cc('A');