"Run Tests" not working in Basic JavaScript class

"Run Tests" not working in Basic JavaScript class
0.0 0

#1

Hi,

I am doing the ‘Counting Cards’ lesson in the ‘Basic JavaScript’ classes. When I click on ‘Run Tests’ nothing happens. I tried it on other lessons and it works but not on this one. Here is the link to the page: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/counting-cards

Niall


#2

Can you provide your code too? Usually this kind of problems happens when some tags / brackets are missing or trying something that it doesn’t like :slight_smile:


#3

Sure.

   if (card <= 6) {
        if (card == 2) {
        count++;
        return count;
        }
        if (card == 3) {
        count++;
        return count;
        }
        if (card == 4) {
        count++;
        return count;
        }
        if (card == 5) {
        count++;
        return count;
        }
        if (card == 6) {
        count++;
        return count;
        }
    } else if (card > 6 && card < 10) {
        if (card == 7 || card == 8 || card == 9) {
            return count;
    } 
    } else {
        count--;
        return count;
        }
  }

I know i should probably be using switch statements but I couldn’t get them to work even in my own text editor so I started off with if statements just to get the logic down.


#4

I got it working now. Not exactly sure what the problem was but when I made certain changes to the code it worked. I also swapped in my switch statements to make it a bit better.