FreeCodeCampChina / FreeCodeCampChina/freecodecamp.cn

counting Cards Bug

Open
#631 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
37.8k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Challenge [Counting Cards](https://freecodecamp.cn/challenges/counting-cards#?solution=var%20count%20%3D%200%3B%0A%0Afunction%20cc(card)%20%7B%0A%20%20%2F%2F%20%E8%AF%B7%E6%8A%8A%E4%BD%A0%E7%9A%84%E4%BB%A3%E7%A0%81%E5%86%99%E5%9C%A8%E8%BF%99%E6%9D%A1%E6%B3%A8%E9%87%8A%E4%BB%A5%E4%B8%8B%0A%20%20%0A%20%20if%20(card%3D%3D2%7C%7Ccard%3D%3D3%7C%7Ccard%3D%3D4%7C%7Ccard%3D%3D5%7C%7Ccard%3D%3D6)%7B%0A%20%20%20%20count%2B%2B%3B%0A%20%20%7Delse%20if(card%3D%3D10%7C%7Ccard%3D%3D'J'%7C%7Ccard%3D%3D'Q'%7C%7Ccard%3D%3D'K'%7C%7Ccard%3D%3D'A')%7B%0A%20%20%20%20return%20count--%3B%0A%20%20%7D%0A%20%20%0A%20%20if%20(count%3E0)%20%7B%0A%20%20%20%20return%20count%2B%22%20Bet%22%3B%0A%20%20%7Delse%20%7B%0A%20%20%20%20return%20count%2B%22%20Hold%22%3B%0A%20%20%7D%0A%20%20%0A%20%20%2F%2F%20%E8%AF%B7%E6%8A%8A%E4%BD%A0%E7%9A%84%E4%BB%A3%E7%A0%81%E5%86%99%E5%9C%A8%E8%BF%99%E6%9D%A1%E6%B3%A8%E9%87%8A%E4%BB%A5%E4%B8%8A%0A%7D%0A%0A%2F%2F%20%E4%BD%A0%E5%8F%AF%E4%BB%A5%E5%9C%A8%E8%BF%99%E9%87%8C%E6%B7%BB%E5%8A%A0%2F%E5%88%A0%E9%99%A4%20cc%20%E6%96%B9%E6%B3%95%E7%9A%84%E8%B0%83%E7%94%A8%E6%9D%A5%E6%B5%8B%E8%AF%95%E7%BB%93%E6%9E%9C%0A%2F%2F%20%E6%8F%90%E7%A4%BA%3A%20%E5%B7%A6%E8%BE%B9%E5%8F%AA%E4%BC%9A%E6%98%BE%E7%A4%BA%E6%9C%80%E5%90%8E%E4%B8%80%E6%AC%A1%E6%89%A7%E8%A1%8C%E7%9A%84%E8%BF%94%E5%9B%9E%E5%80%BC%0Acc(7)%3B%20cc(8)%3B%20cc(9)%3B%20cc(2)%3B%20cc('A')%3B%0A%0A) has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:
```javascript
var count = 0;

function cc(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'){
return count--;
}

if (count>0) {
return count+" Bet";
}else {
return count+" Hold";
}

// 请把你的代码写在这条注释以上
}

// 你可以在这里添加/删除 cc 方法的调用来测试结果
// 提示: 左边只会显示最后一次执行的返回值
cc(7); cc(8); cc(9); cc(2); cc('A');

```

the last cc() can't write 10 or 'J' or 'Q' or 'K' or'A',it does't change the value, others can be executed normally

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.