2018-10-10 18:03:03 -04:00
---
id: cf1111c1c11feddfaeb4bdef
title: Subtract One Number from Another with JavaScript
challengeType: 1
2019-08-28 16:26:13 +03:00
videoUrl: https://scrimba.com/c/cP3yQtk
forumTopicId: 18314
2018-10-10 18:03:03 -04:00
localeTitle: Вычитайте один номер из другого с помощью JavaScript
---
## Description
2019-08-28 16:26:13 +03:00
<section id='description'>
Мы также можем вычесть одно число из другого. JavaScript использует символ <code>-</code> для вычитания. <p> <strong>пример</strong> </p><blockquote> myVar = 12 - 6; // присвоено 6 </blockquote>
</section>
2018-10-10 18:03:03 -04:00
## Instructions
2019-08-28 16:26:13 +03:00
<section id='instructions'>
Измените <code>0</code> так что разница составляет <code>12</code> .
</section>
2018-10-10 18:03:03 -04:00
## Tests
<section id='tests'>
```yml
tests:
2019-08-28 16:26:13 +03:00
- text: Make the variable <code>difference</code> equal 12.
testString: assert(difference === 12);
- text: Only subtract one number from 45.
testString: assert(/var\s*difference\s*=\s*45\s*-\s*[0-9]*;(?!\s*[a-zA-Z0-9]+)/.test(code));
2018-10-10 18:03:03 -04:00
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
var difference = 45 - 0;
```
</div>
2019-08-28 16:26:13 +03:00
### After Tests
2018-10-10 18:03:03 -04:00
<div id='js-teardown'>
```js
2019-08-28 16:26:13 +03:00
(function(z){return 'difference = '+z;})(difference);
2018-10-10 18:03:03 -04:00
```
</div>
</section>
## Solution
<section id='solution'>
```js
2019-08-28 16:26:13 +03:00
var difference = 45 - 33;
2018-10-10 18:03:03 -04:00
```
2019-08-28 16:26:13 +03:00
2018-10-10 18:03:03 -04:00
</section>