Help: Unable to get this code to pass any suggestions appreciated

Tell us what’s happening:

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";
}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

Your browser information:

User Agent is: Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/78.0.3904.84 Mobile/15E148 Safari/604.1.

Challenge: Counting Cards

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/counting-cards

That’s weird. I just threw your code into the challenge, and it worked.

Continuing the discussion from Help: Unable to get this code to pass any suggestions appreciated:

I had a mentor to check it as well and he said the same…However below is the error I keep receiving:

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

5 Bet

Cards Sequence 7, 8, 9 should return

0 Hold

Cards Sequence 10, J, Q, K, A should return

-5 Hold

Cards Sequence 3, 7, Q, 8, A should return

-1 Hold

Cards Sequence 2, J, 9, 2, 7 should return

1 Bet

Cards Sequence 2, 2, 10 should return

1 Bet

Cards Sequence 3, 2, A, 10, K should return

-1 Hold

// tests completed // console output EvalError: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: “default-src ‘self’ http: https: data: blob: ‘unsafe-inline’”.

if you are not using google chrome try with that browser, otherwise you will need to wait

there was a server update and now many things do not work properly

Thanks…I will try again later…hopefully the issue will be resolved then