Tell us what’s happening:
I all accord to video’s code to type,but still can’t pass
**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;
}
if(count>0){return count+"Bet"}else{return count+"Hold"}
return "Change Me";
// Only change code above this line
}
cc(2), cc(3), cc(4), cc(5), cc(6)
console.log(cc())
cc(7), cc(8), cc(9)
console.log(cc())
cc(10);cc('J');cc('Q');cc('k');cc('A')
console.log(cc())
cc(3); cc(7); cc('Q'); cc(8); cc('A');
console.log(cc())
cc(2); cc('J'); cc(9); cc(2); cc(7)
console.log(cc())
cc(2); cc(2); cc(10);
console.log(cc())
cc(3); cc(2); cc('A'); cc(10); cc('K');
console.log(cc())
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
The formatting of your return strings must be exactly as the instructions ask. For example, if you should bet, then the return string should be something like “5 Bet”. Notice the space between the number 5 and the word “Bet”. Do you have a space between these in your return statement?
1.I am sorry,but my English is not good so I can’t understan your meaning,may be the before steps I don’t really understand so I cannot solve this step.
2.I am very interesting in coding,so feel coding is funny but the interest and funny thing that push me to learn. If you are…I am very sorry!
3.May be after few days go ,I return to solve this step probably can pass.
Dear bb:
I had retyped and had passed. Below is my typing:
var count = 0;
function cc(card) {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"}
// 只修改这一行下面的代码
return "Change Me";
// 只修改这一行上面的代码
}
cc(2);cc(3);cc(4);cc(5);cc(6)
console.log(cc())
cc(7);cc(8);cc(9)
console.log(cc())
cc(10);cc("J");cc("Q");cc("K");cc("A")
console.log(cc())
cc(3);cc(7);cc("Q");cc(8);cc("A")
console.log(cc())
cc(2);cc("J");cc(9);cc(2);cc(7)
console.log(cc())
cc(2);cc(2);cc(10)
console.log(cc())
cc(3);cc(2);cc("A");cc(10);cc("K")
console.log(cc())
'''
Though it had passed ,but the result is stranged.
cc(2);cc(3);cc(4);cc(5);cc(6)
console.log(cc())--------show 5 Bet
cc(7);cc(8);cc(9)
console.log(cc())--------show 5 Bet ,Why? It hould be 0 Hold .
cc(10);cc("J");cc("Q");cc("K");cc("A")
console.log(cc())--------show 0 Hold ,Why? It should be -5 Hold.
cc(3);cc(7);cc("Q");cc(8);cc("A")
console.log(cc())------show -1 Hold
cc(2);cc("J");cc(9);cc(2);cc(7)
console.log(cc())-------show 0 Hold, why? It hould be 1 Bet.
cc(2);cc(2);cc(10)
console.log(cc())-------show 1 Bet
cc(3);cc(2);cc("A");cc(10);cc("K")
console.log(cc())--------show 0 Hold , Why? It should be -1 Hold.
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.