Last active
August 16, 2019 18:17
-
-
Save jbmilgrom/dcb4fb25c1dcb4637ed6feca40456621 to your computer and use it in GitHub Desktop.
Example of use of immutable binding
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
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