Missing commas

This commit is contained in:
Brent Guffens 2018-01-18 18:30:06 +01:00 committed by GitHub
parent 089424e276
commit 3cdee0d73b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -426,7 +426,7 @@ function isPrime(n) {
} }
``` ```
The second variant is easier to understand isn't it? Instead of the code piece we see a name of the action (`isPrime`). Sometimes people refer to such code as *self-describing*. The second variant is easier to understand, isn't it? Instead of the code piece we see a name of the action (`isPrime`). Sometimes people refer to such code as *self-describing*.
So, functions can be created even if we don't intend to reuse them. They structure the code and make it readable. So, functions can be created even if we don't intend to reuse them. They structure the code and make it readable.
@ -442,7 +442,7 @@ function name(parameters, delimited, by, comma) {
- Values passed to a function as parameters are copied to its local variables. - Values passed to a function as parameters are copied to its local variables.
- A function may access outer variables. But it works only from inside out. The code outside of the function doesn't see its local variables. - A function may access outer variables. But it works only from inside out. The code outside of the function doesn't see its local variables.
- A function can return a value. If it doesn't then its result is `undefined`. - A function can return a value. If it doesn't, then its result is `undefined`.
To make the code clean and easy to understand, it's recommended to use mainly local variables and parameters in the function, not outer variables. To make the code clean and easy to understand, it's recommended to use mainly local variables and parameters in the function, not outer variables.