2021-06-15 03:34:20 +09:00
|
|
|
---
|
|
|
|
id: bd7993c9ca9feddfaeb7bdef
|
|
|
|
title: Dividere un decimale per un altro con JavaScript
|
|
|
|
challengeType: 1
|
|
|
|
videoUrl: 'https://scrimba.com/c/cBZe9AW'
|
|
|
|
forumTopicId: 18255
|
|
|
|
dashedName: divide-one-decimal-by-another-with-javascript
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
|
|
|
Ora dividiamo un decimale per un altro.
|
|
|
|
|
|
|
|
# --instructions--
|
|
|
|
|
|
|
|
Modifica `0.0` in modo che `quotient` sia uguale a `2.2`.
|
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
|
|
|
La variabile `quotient` dovrebbe essere uguale a `2.2`
|
|
|
|
|
|
|
|
```js
|
|
|
|
assert(quotient === 2.2);
|
|
|
|
```
|
|
|
|
|
|
|
|
Dovresti usare l'operatore `/` per dividere 4.4 per 2
|
|
|
|
|
|
|
|
```js
|
|
|
|
assert(/4\.40*\s*\/\s*2\.*0*/.test(code));
|
|
|
|
```
|
|
|
|
|
|
|
|
La variabile quotient deve essere assegnata solo una volta
|
|
|
|
|
|
|
|
```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 03:34:20 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
const quotient = 4.4 / 2.0;
|
2021-06-15 03:34:20 +09:00
|
|
|
```
|