Hi @martin21,
I’m not quite sure what your question is, so I’ll run through the exercise clarifying a few things. Let me know if my answer didn’t clarify what you were wanting to clarify.
What this function (testLessOrEqual) is doing, is checking if the value of the variable (var) is less or equal than 12 (in the first if statement), and if it’s less or equal than 24 (in the second if statement).
The way if statements work is by running or skipping the code between the { } if the code between the ( ) is true or false:
if (true) {
// this will run
}
if (false) {
// this will not run
}
So, that means that something like this will run:
if (10 > 5) {
// this will run
}
And if we add variables to the mix, it will look something like this:
var a = 10;
if (a > 5) {
// This will run because a is 10...
// if that changes in the future (to be 3 for example),
// this code may stop running
}
That’s the magic of conditional code (like if statements), it allows you to either run code or skip it if something that you want happens or not.
The <= and >= symbols simply mean:
-
<= less or equal.
-
>= greater or equal
Now, when it comes to the
if (val <= "24") {
// ...
}
It works the same as if the "24" didn’t have quotation marks around it. JavaScript, in this situation, reads it the same as if it said 24.
The reason for this is something called “type coercion”. It’s something that JavaScript does. It simply means that, when there is a simple comparison operator (like >=, <=, == or !=), JavaScript transforms the "24" into 24. It changes the ‘type’ (string, number, boolean, etc.) from a string (whatever is between " " is a string in JavaScript), to a number.
In other cases, it changes numbers to strings… It tries to figure out what you were trying to do, and help you do it. In the case above, it figured out that you were trying to compare two numbers together, so it turned the string “24” into a number so that the comparison worked. Other programming languages (like Java) won’t let you compare a number with a string. It will just throw an error.
This is a feature of JavaScript that some people find confusing and frustrating. There’s even a whole version of JavaScript called TypeScript, that was developed to remove this from JavaScript.
If you want to learn more about this, you can google JavaScript Type Coercion. There’s even a freeCodeCamp article about type coercion in JS.
I hope this helps.
Let me know if something else is not clear 
Have a good one,
John