2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: cf1231c1c11feddfaeb5bdef
|
|
|
|
title: Multiply Two Numbers with JavaScript
|
|
|
|
challengeType: 1
|
2019-02-14 12:24:02 -05:00
|
|
|
videoUrl: 'https://scrimba.com/c/cP3y3Aq'
|
2019-07-31 11:32:23 -07:00
|
|
|
forumTopicId: 18243
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
|
|
We can also multiply one number by another.
|
|
|
|
JavaScript uses the <code>*</code> symbol for multiplication of two numbers.
|
|
|
|
|
|
|
|
<strong>Example</strong>
|
2019-05-17 06:20:30 -07:00
|
|
|
|
|
|
|
```js
|
|
|
|
myVar = 13 * 13; // assigned 169
|
|
|
|
```
|
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id='instructions'>
|
|
|
|
Change the <code>0</code> so that product will equal <code>80</code>.
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
2018-10-04 14:37:37 +01:00
|
|
|
tests:
|
|
|
|
- text: Make the variable <code>product</code> equal 80
|
2019-07-13 00:07:53 -07:00
|
|
|
testString: assert(product === 80);
|
2018-10-04 14:37:37 +01:00
|
|
|
- text: Use the <code>*</code> operator
|
2019-07-13 00:07:53 -07:00
|
|
|
testString: assert(/\*/.test(code));
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
var product = 8 * 0;
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
### After Test
|
|
|
|
<div id='js-teardown'>
|
|
|
|
|
|
|
|
```js
|
2018-10-20 21:02:47 +03:00
|
|
|
(function(z){return 'product = '+z;})(product);
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
var product = 8 * 10;
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|