Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created April 24, 2016 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandromoreira/39c26b41859b4090744047aedbb51071 to your computer and use it in GitHub Desktop.
Save leandromoreira/39c26b41859b4090744047aedbb51071 to your computer and use it in GitHub Desktop.
// impure - because you can change promo value (side effect)
// and for the same input X it can produce a different output.
var promo = 40
var isPromo = function(price) {return price === promo}
// pure
var isPromo = function(price) {return price === 40}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment