2021-06-15 07:49:18 +00:00
---
id: 56533eb9ac21ba0edf2244d6
2021-07-21 15:23:20 +00:00
title: Comparar com o operador menor que
2021-06-15 07:49:18 +00:00
challengeType: 1
videoUrl: 'https://scrimba.com/c/cNVRWtB'
forumTopicId: 16789
dashedName: comparison-with-the-less-than-operator
---
# --description--
2021-07-26 14:39:21 +00:00
O operador menor que (`< `) compara os valores de dois números. Se o número à esquerda for menos que o número à direita, retornará `true` . Caso contrário, retorna `false` . Assim como o operador de igualdade, o operador menor que converte os tipos de dados enquanto compara.
2021-06-15 07:49:18 +00:00
2021-07-10 04:23:54 +00:00
**Exemplos**
2021-06-15 07:49:18 +00:00
```js
2 < 5
'3' < 7
5 < 5
3 < 2
'8' < 4
```
2021-07-26 14:39:21 +00:00
Em ordem, essas expressões seriam iguais à `true` , `true` , `false` , `false` e `false` .
2021-06-15 07:49:18 +00:00
# --instructions--
2021-07-10 04:23:54 +00:00
Adicione o operador menor que para indicar as linhas para que a instrução de retorno faça sentido.
2021-06-15 07:49:18 +00:00
# --hints--
2021-07-10 04:23:54 +00:00
`testLessThan(0)` deve retornar a string `Under 25`
2021-06-15 07:49:18 +00:00
```js
assert(testLessThan(0) === 'Under 25');
```
2021-07-10 04:23:54 +00:00
`testLessThan(24)` deve retornar a string `Under 25`
2021-06-15 07:49:18 +00:00
```js
assert(testLessThan(24) === 'Under 25');
```
2021-07-10 04:23:54 +00:00
`testLessThan(25)` deve retornar a string `Under 55`
2021-06-15 07:49:18 +00:00
```js
assert(testLessThan(25) === 'Under 55');
```
2021-07-10 04:23:54 +00:00
`testLessThan(54)` deve retornar a string `Under 55`
2021-06-15 07:49:18 +00:00
```js
assert(testLessThan(54) === 'Under 55');
```
2021-07-10 04:23:54 +00:00
`testLessThan(55)` deve retornar a string `55 or Over`
2021-06-15 07:49:18 +00:00
```js
assert(testLessThan(55) === '55 or Over');
```
2021-07-10 04:23:54 +00:00
`testLessThan(99)` deve retornar a string `55 or Over`
2021-06-15 07:49:18 +00:00
```js
assert(testLessThan(99) === '55 or Over');
```
2021-07-10 04:23:54 +00:00
Você deve usar o operador `<` pelo menos duas vezes
2021-06-15 07:49:18 +00:00
```js
assert(code.match(/val\s*< \s*('|")*\d+('|")*/g).length > 1);
```
# --seed--
## --seed-contents--
```js
function testLessThan(val) {
if (val) { // Change this line
return "Under 25";
}
if (val) { // Change this line
return "Under 55";
}
return "55 or Over";
}
testLessThan(10);
```
# --solutions--
```js
function testLessThan(val) {
if (val < 25 ) { / / Change this line
return "Under 25";
}
if (val < 55 ) { / / Change this line
return "Under 55";
}
return "55 or Over";
}
```