59 lines
2.7 KiB
Markdown
59 lines
2.7 KiB
Markdown
---
|
||
id: 587d7b85367417b2b2512b39
|
||
title: Catch Missing Open and Closing Parenthesis After a Function Call
|
||
challengeType: 1
|
||
videoUrl: ''
|
||
localeTitle: Поймать не открывать и закрывать скобки после вызова функции
|
||
---
|
||
|
||
## Description
|
||
<section id="description"> Когда функция или метод не принимает никаких аргументов, вы можете забыть включить (пустые) открывающие и закрывающие круглые скобки при вызове. Часто время вызова функции сохраняется в переменной для другого использования в вашем коде. Эта ошибка может быть обнаружена путем записи значений переменных (или их типов) в консоль и просмотра того, что для нее задана ссылка на функцию, а не ожидаемое значение, возвращаемое функцией. Переменные в следующем примере отличаются: <blockquote> function myFunction () { <br> возвращение «Ты качаешь!»; <br> } <br> пусть varOne = myFunction; // установить равную функцию <br> пусть varTwo = myFunction (); // установите равную строку «Ты качаешься!» </blockquote></section>
|
||
|
||
## Instructions
|
||
<section id="instructions"> Исправьте код, чтобы <code>result</code> переменной был установлен на значение, возвращаемое из вызова функции <code>getNine</code> . </section>
|
||
|
||
## Tests
|
||
<section id='tests'>
|
||
|
||
```yml
|
||
tests:
|
||
- text: 'Ваш код должен исправить <code>result</code> переменной, чтобы он был установлен на число, возвращаемое функцией <code>getNine</code> .'
|
||
testString: 'assert(result == 9, "Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.");'
|
||
- text: Ваш код должен вызывать функцию <code>getNine</code> .
|
||
testString: 'assert(code.match(/getNine\(\)/g).length == 2, "Your code should call the <code>getNine</code> function.");'
|
||
|
||
```
|
||
|
||
</section>
|
||
|
||
## Challenge Seed
|
||
<section id='challengeSeed'>
|
||
|
||
<div id='js-seed'>
|
||
|
||
```js
|
||
function getNine() {
|
||
let x = 6;
|
||
let y = 3;
|
||
return x + y;
|
||
}
|
||
|
||
let result = getNine;
|
||
console.log(result);
|
||
|
||
```
|
||
|
||
</div>
|
||
|
||
|
||
|
||
</section>
|
||
|
||
## Solution
|
||
<section id='solution'>
|
||
|
||
```js
|
||
// solution required
|
||
```
|
||
</section>
|