2021-02-06 04:42:36 +00:00
|
|
|
---
|
|
|
|
id: 56533eb9ac21ba0edf2244b2
|
2021-03-10 08:16:44 -07:00
|
|
|
title: Asignación compuesta con división aumentada
|
2021-02-06 04:42:36 +00:00
|
|
|
challengeType: 1
|
|
|
|
videoUrl: 'https://scrimba.com/c/c2QvKT2'
|
|
|
|
forumTopicId: 16659
|
|
|
|
dashedName: compound-assignment-with-augmented-division
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
2021-03-10 08:16:44 -07:00
|
|
|
El operador `/=` divide una variable entre otro número.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
2021-03-31 22:38:36 +09:00
|
|
|
```js
|
|
|
|
myVar = myVar / 5;
|
|
|
|
```
|
2021-02-06 04:42:36 +00:00
|
|
|
|
2021-03-31 22:38:36 +09:00
|
|
|
Dividirá `myVar` por `5`. Esto se puede reescribir como:
|
2021-02-06 04:42:36 +00:00
|
|
|
|
2021-03-31 22:38:36 +09:00
|
|
|
```js
|
|
|
|
myVar /= 5;
|
|
|
|
```
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
# --instructions--
|
|
|
|
|
2021-03-31 22:38:36 +09:00
|
|
|
Convierte las tareas de `a`, `b`, y `c` para utilizar el operador `/=`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
2021-03-10 08:16:44 -07:00
|
|
|
`a` debe ser igual a `4`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(a === 4);
|
|
|
|
```
|
|
|
|
|
2021-03-10 08:16:44 -07:00
|
|
|
`b` debe ser igual a `27`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(b === 27);
|
|
|
|
```
|
|
|
|
|
2021-03-10 08:16:44 -07:00
|
|
|
`c` debe ser igual a `3`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(c === 3);
|
|
|
|
```
|
|
|
|
|
2021-03-10 08:16:44 -07:00
|
|
|
Debes usar el operador `/=` para cada variable.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(code.match(/\/=/g).length === 3);
|
|
|
|
```
|
|
|
|
|
2021-03-31 22:38:36 +09:00
|
|
|
No debes modificar el código sobre el comentario especificado.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(
|
2021-10-27 15:10:57 +00:00
|
|
|
/let a = 48;/.test(code) &&
|
|
|
|
/let b = 108;/.test(code) &&
|
|
|
|
/let c = 33;/.test(code)
|
2021-02-06 04:42:36 +00:00
|
|
|
);
|
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --after-user-code--
|
|
|
|
|
|
|
|
```js
|
|
|
|
(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = " + c; })(a,b,c);
|
|
|
|
```
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
let a = 48;
|
|
|
|
let b = 108;
|
|
|
|
let c = 33;
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
// Only change code below this line
|
|
|
|
a = a / 12;
|
|
|
|
b = b / 4;
|
|
|
|
c = c / 11;
|
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
let a = 48;
|
|
|
|
let b = 108;
|
|
|
|
let c = 33;
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
a /= 12;
|
|
|
|
b /= 4;
|
|
|
|
c /= 11;
|
|
|
|
```
|