Почему этот ответ принят, ведь катры не пюсуются, не показана общая сумма count

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

var count = 0;

function cc(card) {
// Only change code below this line
case 2:
case 3:
case 4:
case 5:
case 6:
count++ ;
case 10:
case "J":
case "Q":
case "K":
case "A":
count-- ;
var betHold = "Hold";
return count+" "+betHold ;
// 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/92.0.4515.159 Safari/537.36

Challenge: Counting Cards

Link to the challenge:

требуется ли для теста общий подсчет суммы?
Я не смотрелa…

ваш тест проходит

Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet

Cards Sequence 7, 8, 9 should return the string 0 Hold

Cards Sequence 10, J, Q, K, A should return the string -5 Hold

Cards Sequence 3, 7, Q, 8, A should return the string -1 Hold

Cards Sequence 2, J, 9, 2, 7 should return the string 1 Bet

все объяснено

если хочешь, я могу перевести для тебя

Вопрос в том как тестировать:
`console.log(cc(2,3,4,5)+cc(‘A’)) :negative_squared_cross_mark:

// Cards Sequence 2, 3, 4, 5, 6 should return 5 Bet
console.log(cc(6)) //“5 Bet” :white_check_mark:

I don’t understand what you mean that the count it no shown.

The function is supposed to return a string with the count and the action. The word “count” here is not meant literally. You are not counting the cards in the sense of 1, 2, 3, 4, etc. You are giving a number that tells the player what the surplus is of good cards versus bad cards. (A black jack player likes a lot of 10, J, G, K, and A - it increases their odds of winning so they know to bet more.)

Your given function does that it is suppose to:

// 1 Bet
// 1 Bet
// 0 Hold
// 0 Hold
// -1 Hold

This is exactly what we expect. It keeps a running “count” of the surplus of good cards and the suggested action. It is a running count because the variable count is global so it gets reused for each call, “remembering” its previous value.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.