The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. Otherwise, it returns false.
function testLessThan(val) {
if (val < 10) { // Change this line
return "Under 25";
}
if (val < 54) { // Change this line
return "Under 55";
}
return "55 or Over";
}
You are saying "if the value of the variable val is less than 10, return text stating that the value is less than 25, which is true. However, the value 12 (for example) is also less than 25 but would not satisfy your condition (< 10) because it is greater than 10.
Similarly, “val < 54” does not work correctly if val is equal to 54; you would need to write either “val <= 54” or “val < 55” for the returned value to be correct.
On the task return statements you have the answer (thats where the answer is so its a little confusing)
testGreaterThan(0) should return “10 or Under”
testGreaterThan(10) should return “10 or Under”
testGreaterThan(11) should return “Over 10”
testGreaterThan(99) should return “Over 10”
testGreaterThan(100) should return “Over 10”
testGreaterThan(101) should return “Over 100”
testGreaterThan(150) should return “Over 100”
So greater than 150 and 101 should return Over 100 so the first value should be equal val>100
Then greater than 100, 99 and 11 should return Over 10 so the second value should be equal val>10
Last 2 are the “else” thats left and that is 10 or Under