mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-06 10:36:45 +00:00
Merge pull request #64 from earldouglas/side-effects
Expand side effects to include reading external mutable state
This commit is contained in:
commit
f90841a2d7
1 changed files with 5 additions and 1 deletions
|
|
@ -154,7 +154,11 @@ greet(); // "Hi, Brianne"
|
|||
|
||||
## Side effects
|
||||
|
||||
A function or expression is said to have a side effect if apart from returning a value, it modifies some state or has an observable interaction with external functions.
|
||||
A function or expression is said to have a side effect if apart from returning a value, it interacts with (reads from or writes to) external mutable state.
|
||||
|
||||
```js
|
||||
var differentEveryTime = new Date();
|
||||
```
|
||||
|
||||
```js
|
||||
console.log("IO is a side effect!");
|
||||
|
|
|
|||
Loading…
Reference in a new issue