Created
May 31, 2021 14:28
-
-
Save themgoncalves/22918b64bb3577d6943d0195ee287c80 to your computer and use it in GitHub Desktop.
JavaScript - immutable data types
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 person = 'John Doe'; | |
console.log('initial', person); | |
// outputs: 'John Doe' | |
// try to mutate the data structure | |
// by using the 'upper case' method | |
person.toUpperCase(); | |
console.log('mutation attempt', person); | |
// outputs: 'John Doe' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment