2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: cf1231c1c11feddfaeb5bdef
|
|
|
|
title: Multiply Two Numbers with JavaScript
|
|
|
|
challengeType: 1
|
2019-02-14 17:24:02 +00:00
|
|
|
videoUrl: 'https://scrimba.com/c/cP3y3Aq'
|
2019-07-31 18:32:23 +00:00
|
|
|
forumTopicId: 18243
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: multiply-two-numbers-with-javascript
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
We can also multiply one number by another.
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
JavaScript uses the `*` symbol for multiplication of two numbers.
|
|
|
|
|
|
|
|
**Example**
|
2019-05-17 13:20:30 +00:00
|
|
|
|
|
|
|
```js
|
2021-03-03 00:12:12 +00:00
|
|
|
myVar = 13 * 13;
|
2019-05-17 13:20:30 +00:00
|
|
|
```
|
|
|
|
|
2021-03-03 00:12:12 +00:00
|
|
|
`myVar` would have the value `169`.
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --instructions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Change the `0` so that product will equal `80`.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --hints--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
The variable `product` should be equal to 80.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
|
|
|
assert(product === 80);
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
You should use the `*` operator.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
2020-11-27 18:02:05 +00:00
|
|
|
assert(/\*/.test(code));
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --seed--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
## --after-user-code--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
2018-10-20 18:02:47 +00:00
|
|
|
(function(z){return 'product = '+z;})(product);
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
## --seed-contents--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
|
|
|
var product = 8 * 0;
|
|
|
|
```
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
var product = 8 * 10;
|
|
|
|
```
|