2021-06-15 00:49:18 -07:00
|
|
|
---
|
|
|
|
id: bd7993c9ca9feddfaeb7bdef
|
2021-07-21 20:53:20 +05:30
|
|
|
title: Dividir um decimal por outro com JavaScript
|
2021-06-15 00:49:18 -07:00
|
|
|
challengeType: 1
|
|
|
|
videoUrl: 'https://scrimba.com/c/cBZe9AW'
|
|
|
|
forumTopicId: 18255
|
|
|
|
dashedName: divide-one-decimal-by-another-with-javascript
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
2021-07-09 21:23:54 -07:00
|
|
|
Agora vamos dividir um decimal por outro.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
# --instructions--
|
|
|
|
|
2021-07-09 21:23:54 -07:00
|
|
|
Modifique `0.0` para que a variável `quotient` seja igual a `2.2`.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
2021-07-09 21:23:54 -07:00
|
|
|
A variável `quotient` deve ser igual a `2.2`
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(quotient === 2.2);
|
|
|
|
```
|
|
|
|
|
2021-07-09 21:23:54 -07:00
|
|
|
Você deve usar o operador `/` para dividir 4.4 por 2
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(/4\.40*\s*\/\s*2\.*0*/.test(code));
|
|
|
|
```
|
|
|
|
|
2021-07-09 21:23:54 -07:00
|
|
|
A variável quotient deve ser atribuída apenas uma vez
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(code.match(/quotient/g).length === 1);
|
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --after-user-code--
|
|
|
|
|
|
|
|
```js
|
|
|
|
(function(y){return 'quotient = '+y;})(quotient);
|
|
|
|
```
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
const quotient = 0.0 / 2.0; // Change this line
|
2021-06-15 00:49:18 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
const quotient = 4.4 / 2.0;
|
2021-06-15 00:49:18 -07:00
|
|
|
```
|