Skip to content

Instantly share code, notes, and snippets.

@jbmilgrom
Last active August 16, 2019 18:17
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 jbmilgrom/dcb4fb25c1dcb4637ed6feca40456621 to your computer and use it in GitHub Desktop.
Save jbmilgrom/dcb4fb25c1dcb4637ed6feca40456621 to your computer and use it in GitHub Desktop.
Example of use of immutable binding
const oneHundred = 100; // <-- now a `const` instead of a `let`
const decrementOneHundred = x => oneHundred - x;
decrementOneHundred(20); // 80
// oneHundred = 80; <-- would be runtime error: "TypeError: Assignment to constant variable."
decrementOneHundred(20); // 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment