less than or equal to
operator (<=
) compares the values of two numbers. If the number to the left is less than or equal to the number to the right, it returns true
. If the number on the left is greater than the number on the right, it returns false
. Like the equality operator, less than or equal to
converts data types.
Examples
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
less than or equal to
operator to the indicated lines so that the return statements make sense.
testLessOrEqual(0)
should return "Smaller Than or Equal to 12"
testString: 'assert(testLessOrEqual(0) === "Smaller Than or Equal to 12", "testLessOrEqual(0)
should return "Smaller Than or Equal to 12"");'
- text: testLessOrEqual(11)
should return "Smaller Than or Equal to 12"
testString: 'assert(testLessOrEqual(11) === "Smaller Than or Equal to 12", "testLessOrEqual(11)
should return "Smaller Than or Equal to 12"");'
- text: testLessOrEqual(12)
should return "Smaller Than or Equal to 12"
testString: 'assert(testLessOrEqual(12) === "Smaller Than or Equal to 12", "testLessOrEqual(12)
should return "Smaller Than or Equal to 12"");'
- text: testLessOrEqual(23)
should return "Smaller Than or Equal to 24"
testString: 'assert(testLessOrEqual(23) === "Smaller Than or Equal to 24", "testLessOrEqual(23)
should return "Smaller Than or Equal to 24"");'
- text: testLessOrEqual(24)
should return "Smaller Than or Equal to 24"
testString: 'assert(testLessOrEqual(24) === "Smaller Than or Equal to 24", "testLessOrEqual(24)
should return "Smaller Than or Equal to 24"");'
- text: testLessOrEqual(25)
should return "More Than 24"
testString: 'assert(testLessOrEqual(25) === "More Than 24", "testLessOrEqual(25)
should return "More Than 24"");'
- text: testLessOrEqual(55)
should return "More Than 24"
testString: 'assert(testLessOrEqual(55) === "More Than 24", "testLessOrEqual(55)
should return "More Than 24"");'
- text: You should use the <=
operator at least twice
testString: 'assert(code.match(/val\s*<=\s*("|")*\d+("|")*/g).length > 1, "You should use the <=
operator at least twice");'
```