2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Comparison with the Less Than Operator
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Comparison with the Less Than Operator
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
|
|
|
|
|
|
|
### Hint 1
|
2018-10-12 15:37:13 -04:00
|
|
|
**`<`** (Less Than) is a logical operator that returns true case the value on the left is lower than the one on the right.
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Solutions
|
|
|
|
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
function testLessThan(val) {
|
2019-07-24 00:59:27 -07:00
|
|
|
if (val < 25) return "Under 25";
|
|
|
|
|
|
|
|
if (val < 55) return "Under 55";
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
return "55 or Over";
|
|
|
|
}
|
2019-07-24 00:59:27 -07:00
|
|
|
```
|
|
|
|
</details>
|