58 lines
788 B
Markdown
58 lines
788 B
Markdown
---
|
|
id: cf1111c1c11feddfaeb6bdef
|
|
title: Divide One Number by Another with JavaScript
|
|
challengeType: 1
|
|
videoUrl: 'https://scrimba.com/c/cqkbdAr'
|
|
forumTopicId: 17566
|
|
---
|
|
|
|
# --description--
|
|
|
|
We can also divide one number by another.
|
|
|
|
JavaScript uses the `/` symbol for division.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
myVar = 16 / 2; // assigned 8
|
|
```
|
|
|
|
# --instructions--
|
|
|
|
Change the `0` so that the `quotient` is equal to `2`.
|
|
|
|
# --hints--
|
|
|
|
The variable `quotient` should be equal to 2.
|
|
|
|
```js
|
|
assert(quotient === 2);
|
|
```
|
|
|
|
You should use the `/` operator.
|
|
|
|
```js
|
|
assert(/\d+\s*\/\s*\d+/.test(code));
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --after-user-code--
|
|
|
|
```js
|
|
(function(z){return 'quotient = '+z;})(quotient);
|
|
```
|
|
|
|
## --seed-contents--
|
|
|
|
```js
|
|
var quotient = 66 / 0;
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```js
|
|
var quotient = 66 / 33;
|
|
```
|