<
) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true
. Otherwise, it returns false
. Like the equality operator, less than operator converts data types while comparing.
Examples
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
less than
operator to the indicated lines so that the return statements make sense.
testLessThan(0)
should return "Under 25"
testString: 'assert(testLessThan(0) === "Under 25", ''testLessThan(0)
should return "Under 25"'');'
- text: testLessThan(24)
should return "Under 25"
testString: 'assert(testLessThan(24) === "Under 25", ''testLessThan(24)
should return "Under 25"'');'
- text: testLessThan(25)
should return "Under 55"
testString: 'assert(testLessThan(25) === "Under 55", ''testLessThan(25)
should return "Under 55"'');'
- text: testLessThan(54)
should return "Under 55"
testString: 'assert(testLessThan(54) === "Under 55", ''testLessThan(54)
should return "Under 55"'');'
- text: testLessThan(55)
should return "55 or Over"
testString: 'assert(testLessThan(55) === "55 or Over", ''testLessThan(55)
should return "55 or Over"'');'
- text: testLessThan(99)
should return "55 or Over"
testString: 'assert(testLessThan(99) === "55 or Over", ''testLessThan(99)
should return "55 or Over"'');'
- 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'');'
```