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.
This commit is contained in:
Mustafa Kemal Tuna 2021-01-10 00:01:17 +03:00 committed by GitHub
parent 2027939238
commit 6a432df33b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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