freeCodeCamp/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md
Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

68 lines
1.5 KiB
Markdown

---
id: 587d7b85367417b2b2512b39
title: Catch Missing Open and Closing Parenthesis After a Function Call
challengeType: 1
forumTopicId: 301185
dashedName: catch-missing-open-and-closing-parenthesis-after-a-function-call
---
# --description--
When a function or method doesn't take any arguments, you may forget to include the (empty) opening and closing parentheses when calling it. Often times the result of a function call is saved in a variable for other use in your code. This error can be detected by logging variable values (or their types) to the console and seeing that one is set to a function reference, instead of the expected value the function returns.
The variables in the following example are different:
```js
function myFunction() {
return "You rock!";
}
let varOne = myFunction; // set to equal a function
let varTwo = myFunction(); // set to equal the string "You rock!"
```
# --instructions--
Fix the code so the variable `result` is set to the value returned from calling the function `getNine`.
# --hints--
Your code should fix the variable `result` so it is set to the number that the function `getNine` returns.
```js
assert(result == 9);
```
Your code should call the `getNine` function.
```js
assert(code.match(/getNine\(\)/g).length == 2);
```
# --seed--
## --seed-contents--
```js
function getNine() {
let x = 6;
let y = 3;
return x + y;
}
let result = getNine;
console.log(result);
```
# --solutions--
```js
function getNine() {
let x = 6;
let y = 3;
return x + y;
}
let result = getNine();
console.log(result);
```