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 array = [1, 2, 3]; | |
array = [4, 5, 6]; // yes, it works! We can not mutate data but ... | |
array[0] = 4; // hmmm, now we have an alternative way to mutate data. | |
console.log(array); // returns [4, 2, 3] | |
Object.freeze(array); // The array cannot be modified. | |
array[0] = 1; // fails |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment