# Comparisons with the Logical And Operator

Comparisons with the Logical And Operator
0

#1

Tell us what’s happening:

Hey Y’all please i need you help seems i like this challenge is to complicated to me thanks in advance

``````function testLogicalAnd(val) {
// Only change code below this line

if (val <= 24 && val > 50) {
return "Yes";
}

// Only change code above this line
return "No";
}

// Change this value to test
testLogicalAnd(24);
``````

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36`.

https://www.freecodecamp.org/challenges/comparisons-with-the-logical-and-operator

#3

That was pretty close!

Two things to note, the instructions say

if val is less than or equal to 50. The less than sign is < so you would actually use

`val <= 50`

if val is greater than or equal to 25, make sure you include equal to sign. So this would turn to be

`val >= 25`

go head and combine them with logical operator and you will pass the challenge

#4

I was stuck with this as well, and found out that if you lessen the 50 and the 25 you will pass.

Basically like this if (val > 24 && < 54) will get you a pass as well…

Just wanted to put it out for those who are wondering and are stuck

#5

In order to improve this conversation I am adding a screenshot. I believe that I did exactly what was asked and even what you suggest. Am I overlooking something. I have been stuck for over 15 minutes and searched for the solution as well. I must be overlooking something but I do not know what yet.

Regards,
A.

#6

Your 50 is not compared to anything. It’s just floating out there with comparing it to nothing.

You need to add val before <= 50

#7

Ahaaa (was confusing the shorthand ternary operator with this.) Ok so I need to use the variable name each time. Nice. Thank you for your observant eye!