mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-08 19:46:41 +00:00
Expand side effects to include reading external mutable state
This commit is contained in:
parent
98fbaff76b
commit
b0e8112cac
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