<
)比较两个数字的值。如果左边的数字小于右边的数字,则返回true
。否则,它返回false
。与等于运算符一样, 少于运算符在比较时转换数据类型。 例子 2 <5 //是的
'3'<7 //是的
5 <5 //假
3 <2 //假
'8'<4 //假
less than
运算符添加到指示的行,以便返回语句有意义。 testLessThan(0)
应该返回“25岁以下”
testString: 'assert(testLessThan(0) === "Under 25", "testLessThan(0)
should return "Under 25"");'
- text: testLessThan(24)
应该返回“25岁以下”
testString: 'assert(testLessThan(24) === "Under 25", "testLessThan(24)
should return "Under 25"");'
- text: testLessThan(25)
应该返回“55岁以下”
testString: 'assert(testLessThan(25) === "Under 55", "testLessThan(25)
should return "Under 55"");'
- text: testLessThan(54)
应该返回“55岁以下”
testString: 'assert(testLessThan(54) === "Under 55", "testLessThan(54)
should return "Under 55"");'
- text: testLessThan(55)
应返回“55或以上”
testString: 'assert(testLessThan(55) === "55 or Over", "testLessThan(55)
should return "55 or Over"");'
- text: testLessThan(99)
应返回“55或以上”
testString: 'assert(testLessThan(99) === "55 or Over", "testLessThan(99)
should return "55 or Over"");'
- text: 您应该至少使用<
运算符两次
testString: 'assert(code.match(/val\s*<\s*("|")*\d+("|")*/g).length > 1, "You should use the <
operator at least twice");'
```