2021-02-06 04:42:36 +00:00
|
|
|
---
|
|
|
|
id: cf1111c1c11feddfaeb6bdef
|
2021-02-21 15:49:16 +00:00
|
|
|
title: Divide un número entre otro con JavaScript
|
2021-02-06 04:42:36 +00:00
|
|
|
challengeType: 1
|
|
|
|
videoUrl: 'https://scrimba.com/c/cqkbdAr'
|
|
|
|
forumTopicId: 17566
|
|
|
|
dashedName: divide-one-number-by-another-with-javascript
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
2021-02-21 15:49:16 +00:00
|
|
|
También podemos dividir un número entre otro.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
2021-02-21 15:49:16 +00:00
|
|
|
JavaScript utiliza el símbolo `/` para la división.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
2021-02-21 15:49:16 +00:00
|
|
|
**Ejemplo**
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
2021-03-10 15:16:44 +00:00
|
|
|
myVar = 16 / 2;
|
2021-02-06 04:42:36 +00:00
|
|
|
```
|
|
|
|
|
2021-03-10 15:16:44 +00:00
|
|
|
`myVar` ahora tiene el valor `8`.
|
2021-02-06 04:42:36 +00:00
|
|
|
# --instructions--
|
|
|
|
|
2021-02-21 15:49:16 +00:00
|
|
|
Cambia el `0` para que el `quotient` (cociente) sea igual a `2`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
2021-02-21 15:49:16 +00:00
|
|
|
La variable `quotient` debe ser igual a 2.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(quotient === 2);
|
|
|
|
```
|
|
|
|
|
2021-02-21 15:49:16 +00:00
|
|
|
Debes usar el operador `/`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(/\d+\s*\/\s*\d+/.test(code));
|
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --after-user-code--
|
|
|
|
|
|
|
|
```js
|
|
|
|
(function(z){return 'quotient = '+z;})(quotient);
|
|
|
|
```
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
|
|
|
var quotient = 66 / 0;
|
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
|
|
|
var quotient = 66 / 33;
|
|
|
|
```
|