mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
refactor(curriculum): JS Functions (#58407)
This commit is contained in:
parent
205da31ac4
commit
59a5834040
@ -146,35 +146,49 @@ Pay attention to the default parameter and how many arguments are passed to the
|
||||
|
||||
## --text--
|
||||
|
||||
Which statement about functions in JavaScript is true?
|
||||
Which of the following is the correct way to call (or invoke) the `sum` function?
|
||||
|
||||
```js
|
||||
function sum(num1, num2) {
|
||||
return num1 + num2
|
||||
}
|
||||
```
|
||||
|
||||
## --answers--
|
||||
|
||||
Functions always need to have a `return` statement.
|
||||
```js
|
||||
()sum>
|
||||
```
|
||||
|
||||
### --feedback--
|
||||
|
||||
Think about the special properties of functions in JavaScript that we discussed.
|
||||
Review the first minute of the video where function calls were discussed.
|
||||
|
||||
---
|
||||
|
||||
Functions can only return one value.
|
||||
```js
|
||||
()sum()
|
||||
```
|
||||
|
||||
### --feedback--
|
||||
|
||||
Think about the special properties of functions in JavaScript that we discussed.
|
||||
Review the first minute of the video where function calls were discussed.
|
||||
|
||||
---
|
||||
|
||||
Functions are first-class objects in JavaScript.
|
||||
```js
|
||||
sum()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Functions cannot be passed as arguments to other functions.
|
||||
```js
|
||||
<sum>
|
||||
```
|
||||
|
||||
### --feedback--
|
||||
|
||||
Think about the special properties of functions in JavaScript that we discussed.
|
||||
Review the first minute of the video where function calls were discussed.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user