Last active
April 21, 2020 14:34
-
-
Save sorinpav/fc658eeef345cbc4b271696a29629fe6 to your computer and use it in GitHub Desktop.
What a pure function is
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
const addNumbers(a,b) => return num + a + b; | |
//Pure functions def: A function which returns the exact same result every time, when given the exact same arguments. | |
//I.e. a function is NOT pure when the same arguments might give different outputs (i.e. imagine making API calls | |
//and getting 'num' from above through an API call, which in turn means the num value might be different, since | |
//the data fetched from the API might be different. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment