Getting stuck with: Comparisons with the Logical And Operator

The task:

Combine the two if statements into one statement which will return "Yes" if val is less than or equal to 50 and greater than or equal to 25 . Otherwise, will return "No" .

What I understood:
Then first we need to set 50 less our equal to which we did with the the <=
Then we use the && to combine them into one like the example
then it ask to set it equal to 25 which is the ==

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

  if (val < = 50 && val == 25) {
      return "Yes";

Where did I go wrong here?

Your code will only return “Yes” if val is exactly 25. Your conditional says “If val is less than or equal to 50 AND val is 25, return ‘Yes’”.

1 Like

I see what you mean :3 ty AL
I did need to put the 25 first since they asked equal to 25 and greater then 50.
The sollution then becomes:

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

There you go.