2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: cf1231c1c11feddfaeb5bdef
|
2021-02-06 04:42:36 +00:00
|
|
|
title: Multiply Two Numbers with JavaScript
|
2018-10-10 18:03:03 -04:00
|
|
|
challengeType: 1
|
2020-04-29 18:29:13 +08:00
|
|
|
videoUrl: 'https://scrimba.com/c/cP3y3Aq'
|
|
|
|
forumTopicId: 18243
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: multiply-two-numbers-with-javascript
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --description--
|
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
We can also multiply one number by another.
|
2020-04-29 18:29:13 +08:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
JavaScript uses the `*` symbol for multiplication of two numbers.
|
2020-12-16 00:37:30 -07:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
**Example**
|
2020-04-29 18:29:13 +08:00
|
|
|
|
|
|
|
```js
|
|
|
|
myVar = 13 * 13; // assigned 169
|
|
|
|
```
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --instructions--
|
2020-04-29 18:29:13 +08:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
Change the `0` so that product will equal `80`.
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --hints--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
The variable `product` should be equal to 80.
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```js
|
2020-12-16 00:37:30 -07:00
|
|
|
assert(product === 80);
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2021-02-06 04:42:36 +00:00
|
|
|
You should use the `*` operator.
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```js
|
2020-12-16 00:37:30 -07:00
|
|
|
assert(/\*/.test(code));
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --after-user-code--
|
|
|
|
|
|
|
|
```js
|
|
|
|
(function(z){return 'product = '+z;})(product);
|
|
|
|
```
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
|
|
|
var product = 8 * 0;
|
|
|
|
```
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --solutions--
|
2020-04-29 18:29:13 +08:00
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
```js
|
|
|
|
var product = 8 * 10;
|
|
|
|
```
|