JavaScript Algorithms and Data Structures Issues

Hi, guys. I was just wondering if anyone is having issues with their code passing the tests in the JS course? This didn’t start happening to me until I hit the “comparison operators” section, but when I enter the code, it gives me an error. When I click “hint”, my answer is the EXACT same as the example/solution. If I copy/paste the answer (which was the exact same as my original input), it works fine. Anyone know why or how I can avoid the error going forward? TIA!

ETA: I did make sure that it was not due to too many or too little spaces or misspelling.

Link to one of the challenges where I got the error: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator

Copy of my code that was failing: (idk how to add the correct spacing, it takes away the block)

function testLogicalAnd(val) {
// Only change code below this line
if (val <= 50 && >= 25) {
return “Yes”;
}
// Only change code above this line
return “No”;
}
testLogicalAnd(10);

The error I’m getting is:

SyntaxError: unknown: Unexpected token (4:17)
2 | // Only change code below this line
3 |
4 | if (val <= 50 && >= 25) {

Could you post a link to the challenge you are working on along with a copy of the code you have written? It would make it easier to see what the problem is.

@bvanb I just edited to add that info. Sorry about that. The link I provided is for the lesson in my code example, but it happened with multiple questions in this area of the course

You have a syntax error, double check your code!

1 Like

Suggestion. It’s easy to overlook this detail:
Take a careful look at your if test … are you actually testing var in each case on both sides of the &&?

Make both conditions have an identifier not just one …example;.*[val = 50 && val = 60]…**

try
if (val <= 50 && val >=25)