60 lines
894 B
Markdown
60 lines
894 B
Markdown
---
|
|
id: cf1111c1c11feddfaeb6bdef
|
|
title: Dividere un numero per un altro con JavaScript
|
|
challengeType: 1
|
|
videoUrl: 'https://scrimba.com/c/cqkbdAr'
|
|
forumTopicId: 17566
|
|
dashedName: divide-one-number-by-another-with-javascript
|
|
---
|
|
|
|
# --description--
|
|
|
|
Possiamo anche dividere un numero per un altro.
|
|
|
|
JavaScript utilizza il simbolo `/` per la divisione.
|
|
|
|
**Esempio**
|
|
|
|
```js
|
|
const myVar = 16 / 2;
|
|
```
|
|
|
|
`myVar` ora ha il valore `8`.
|
|
# --instructions--
|
|
|
|
Modifica lo `0` in modo che `quotient` sia uguale a `2`.
|
|
|
|
# --hints--
|
|
|
|
La variabile `quotient` dovrebbe essere uguale a 2.
|
|
|
|
```js
|
|
assert(quotient === 2);
|
|
```
|
|
|
|
Dovresti usare l'operatore `/`.
|
|
|
|
```js
|
|
assert(/\d+\s*\/\s*\d+/.test(code));
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --after-user-code--
|
|
|
|
```js
|
|
(function(z){return 'quotient = '+z;})(quotient);
|
|
```
|
|
|
|
## --seed-contents--
|
|
|
|
```js
|
|
const quotient = 66 / 0;
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```js
|
|
const quotient = 66 / 33;
|
|
```
|