Counting Cards exercise / Question about a code

Tell us what’s happening:

Hi everyone !

I’m practicing coding on FreeCodeCamp for a few weeks now. I’m also using the app Grasshopper (There might be things that I learned there but not yet on Freecodecamp on my code).

I’m on the counting cards exercise right now, I haven’t looked at the answer since I find it intersting to code and I don’t want to get “spoiled” (sorry for my english, I’m actually french).
I understand that my code is wrong but I don’t really get why.
Anyone could tell me me the reason ?

Thank you !

  **Your code so far**

var count = 0;
function cc(card) {
// Only change code below this line
var cardChangePlus = [2, 3, 4, 5, 6]
var cardChangeNul = [7, 8, 9]
var cardChangeMinus = [10, 'J', 'Q', 'K', 'A']

for(var numPlus of cardChangePlus) {
      if(card === numPlus) {
    return count++;
for(var numNul of cardChangeNul) { 
    if(count > 0 || card === numNul ) {
      return count = count--;
  } else if(count < 0 || card === numNul ) {
      return count++; 
for(var numMinus of cardChangeMinus){
    if(card === numMinus) {
      return count = count--;
return count;
// 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/88.0.4324.182 Safari/537.36.

Challenge: Counting Cards

Link to the challenge:

check again what the challenge says to return

also it is not necessary to use a loop, here, it makes the logic unnecessary complicated

card is a single element not an entire array of elements, and if you are ever confused by what the argument you are being handed is just log it as such console.log(typeof argument) this will tell you they type of the argument which can be a boolean, string, number, object, and there may be a few more types, but those are pretty common ones. Both an array, and an object are of type object.

Restarting the challenge would be best as your current code cannot be made to work.