Expand side effects to include reading external mutable state

This commit is contained in:
James Earl Douglas 2016-07-24 22:36:55 -06:00
parent 98fbaff76b
commit b0e8112cac

View file

@ -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!");