Skip to content

Commit 6a432df

Browse files
authored
parameters are also local variables
We can declare local variables and give them initial values in parameter list of function definition. So we have another way to create local variables.
1 parent 2027939 commit 6a432df

File tree

1 file changed

+1
-1
lines changed
  • 1-js/02-first-steps/18-javascript-specials

1 file changed

+1
-1
lines changed

1-js/02-first-steps/18-javascript-specials/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ We covered three ways to create a function in JavaScript:
273273
```
274274
275275
276-
- Functions may have local variables: those declared inside its body. Such variables are only visible inside the function.
276+
- Functions may have local variables: those declared inside its body or its parameter list. Such variables are only visible inside the function.
277277
- Parameters can have default values: `function sum(a = 1, b = 2) {...}`.
278278
- Functions always return something. If there's no `return` statement, then the result is `undefined`.
279279

0 commit comments

Comments
 (0)