Skip to content

Instantly share code, notes, and snippets.

@themgoncalves
Created May 31, 2021 14:28
Show Gist options
  • Save themgoncalves/22918b64bb3577d6943d0195ee287c80 to your computer and use it in GitHub Desktop.
Save themgoncalves/22918b64bb3577d6943d0195ee287c80 to your computer and use it in GitHub Desktop.
JavaScript - immutable data types
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