Created
June 20, 2017 14:47
-
-
Save jardix22/37b231882b1420cc0f3dbf4462c76e88 to your computer and use it in GitHub Desktop.
Impure and pure functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Impure function | |
const b = 10 | |
const impureFunction = (a) => { | |
return a + b; | |
} | |
impureFunction(4) | |
// Pure function | |
const pureFunction = (a, b) => { | |
return a + b; | |
} | |
pureFunction(1, 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment