FreeCodeCampChina/freecodecamp.cn

counting Cards Bug

dnan04 opened this issue · 0 comments

Challenge Counting Cards 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:

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