2021-02-06 04:42:36 +00:00
|
|
|
---
|
|
|
|
id: 56533eb9ac21ba0edf2244b1
|
2021-02-21 08:49:16 -07:00
|
|
|
title: Asignación compuesta con multiplicación aumentada
|
2021-02-06 04:42:36 +00:00
|
|
|
challengeType: 1
|
|
|
|
videoUrl: 'https://scrimba.com/c/c83vrfa'
|
|
|
|
forumTopicId: 16662
|
|
|
|
dashedName: compound-assignment-with-augmented-multiplication
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
2021-02-21 08:49:16 -07:00
|
|
|
El operador `*=` multiplica una variable por un 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
|
|
|
se multiplicará `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-02-21 08:49:16 -07:00
|
|
|
`a` debe ser igual a `25`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(a === 25);
|
|
|
|
```
|
|
|
|
|
2021-02-21 08:49:16 -07:00
|
|
|
`b` debe ser igual a `36`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(b === 36);
|
|
|
|
```
|
|
|
|
|
2021-02-21 08:49:16 -07:00
|
|
|
`c` debe ser igual a `46`.
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
assert(c === 46);
|
|
|
|
```
|
|
|
|
|
2021-02-21 08:49:16 -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 = 5;/.test(code) &&
|
|
|
|
/let b = 12;/.test(code) &&
|
|
|
|
/let c = 4\.6;/.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 = 5;
|
|
|
|
let b = 12;
|
|
|
|
let c = 4.6;
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
// Only change code below this line
|
|
|
|
a = a * 5;
|
|
|
|
b = 3 * b;
|
|
|
|
c = c * 10;
|
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
2021-10-27 15:10:57 +00:00
|
|
|
let a = 5;
|
|
|
|
let b = 12;
|
|
|
|
let c = 4.6;
|
2021-02-06 04:42:36 +00:00
|
|
|
|
|
|
|
a *= 5;
|
|
|
|
b *= 3;
|
|
|
|
c *= 10;
|
|
|
|
```
|