Skip to content

Instantly share code, notes, and snippets.

@dengjonathan
Created September 10, 2016 17:14
Show Gist options
  • Save dengjonathan/36abfbb3e261ee1e082d8f2b8528d4f6 to your computer and use it in GitHub Desktop.
Save dengjonathan/36abfbb3e261ee1e082d8f2b8528d4f6 to your computer and use it in GitHub Desktop.
shows difference between a pure function and not pure
// this is better
function plusOne(number) {
return number++;
}
plusOne(5); // 6
// this is worse
var number = 5;
function plusOne() {
return number++;
}
plusOne(); // 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment