mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-06 02:26:43 +00:00
Purity.
This commit is contained in:
parent
5a836308db
commit
e5fd793982
1 changed files with 10 additions and 1 deletions
11
readme.md
11
readme.md
|
|
@ -64,7 +64,16 @@ curriedSum(40)(2) // 42.
|
|||
---
|
||||
|
||||
## Purity
|
||||
> A function is said to be pure if the return value is only determined by its
|
||||
input values, without any side effects.
|
||||
|
||||
```js
|
||||
let greet = "yo";
|
||||
|
||||
greet.toUpperCase(); // YO;
|
||||
|
||||
greet // yo;
|
||||
```
|
||||
---
|
||||
|
||||
## Side effects
|
||||
|
|
@ -77,7 +86,7 @@ executions with the the same input parameters.
|
|||
|
||||
`f(f(x)) = f(x)`
|
||||
|
||||
`Math.abs(Math.abs(10))`
|
||||
`Math.abs(Math.abs(10))`
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue