Created
September 10, 2016 19:07
-
-
Save dengjonathan/506325caaaf1466505efc2b5e1d417cb to your computer and use it in GitHub Desktop.
pure function
This file contains 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
var d = 'not modified'; | |
// add is a pure function that doesn't modify anything out of its scope | |
function add(x, y) { | |
return x + y; | |
} | |
add(2, 3) // 5 | |
add(2, 3) // always gonna be 5 | |
console.log(d) // 'not modified' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment