Files
freeCodeCamp/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md
2022-12-22 09:23:26 -08:00

85 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: 56533eb9ac21ba0edf2244ad
title: Зменшення числа з JavaScript
challengeType: 1
videoUrl: 'https://scrimba.com/c/cM2KeS2'
forumTopicId: 17558
dashedName: decrement-a-number-with-javascript
---
# --description--
Ви можете легко <dfn>зменшити</dfn> або збільшити змінну на один за допомогою оператора `--`.
```js
i--;
```
те й саме, що
```js
i = i - 1;
```
**Примітка:** весь рядок стає `i--;`, усуваючи потребу в знаку рівності.
# --instructions--
Змініть код, щоб використати оператор `--` на `myVar`.
# --hints--
`myVar` повинна дорівнювати `10`.
```js
assert(myVar === 10);
```
`myVar = myVar - 1;` потрібно змінити.
```js
assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/));
```
Ви не повинні присвоювати `10` до `myVar`.
```js
assert(!code.match(/myVar\s*=\s*10.*?;?/));
```
Ви повинні використати оператор `--` на `myVar`.
```js
assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code));
```
Не змінюйте код над зазначеним коментарем.
```js
assert(/let myVar = 11;/.test(code));
```
# --seed--
## --after-user-code--
```js
(function(z){return 'myVar = ' + z;})(myVar);
```
## --seed-contents--
```js
let myVar = 11;
// Only change code below this line
myVar = myVar - 1;
```
# --solutions--
```js
let myVar = 11;
myVar--;
```