Skip to content

Commit

Permalink
Update introduction.md (#2517)
Browse files Browse the repository at this point in the history
Add a paragraph and example about storing a function's return value in a variable.
  • Loading branch information
JorensM authored Oct 18, 2024
1 parent adee93b commit 8f87893
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions exercises/concept/lasagna-master/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ function checkNumber(num) {
}
```

The return value of a function can be stored in a variable.

```javascript
function sum(x, y) {
return x + y;
}

const total = sum(5, 10);
// => 15
```

The result of a function that `return`s no value or does not have a `return` statement is `undefined`.
There are no implicit `return`s in JavaScript.

Expand Down

0 comments on commit 8f87893

Please sign in to comment.