2018-09-30 23:01:58 +01:00
---
id: 587d7b85367417b2b2512b39
title: Catch Missing Open and Closing Parenthesis After a Function Call
challengeType: 1
2019-08-05 09:17:33 -07:00
forumTopicId: 301185
2021-01-13 03:31:00 +01:00
dashedName: catch-missing-open-and-closing-parenthesis-after-a-function-call
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
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.
2020-11-27 19:02:05 +01:00
2018-09-30 23:01:58 +01:00
The variables in the following example are different:
2019-05-17 06:20:30 -07:00
```js
function myFunction() {
return "You rock!";
}
let varOne = myFunction; // set to equal a function
let varTwo = myFunction(); // set to equal the string "You rock!"
```
2020-11-27 19:02:05 +01:00
# --instructions--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
Fix the code so the variable `result` is set to the value returned from calling the function `getNine` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --hints--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
Your code should fix the variable `result` so it is set to the number that the function `getNine` returns.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert(result == 9);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
Your code should call the `getNine` function.
```js
assert(code.match(/getNine\(\)/g).length == 2);
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
function getNine() {
let x = 6;
let y = 3;
return x + y;
}
let result = getNine;
console.log(result);
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
2019-04-18 11:44:20 -07:00
function getNine() {
let x = 6;
let y = 3;
return x + y;
}
let result = getNine();
console.log(result);
2018-09-30 23:01:58 +01:00
```