Created
December 24, 2018 12:20
-
-
Save h3nr1ke/9f08da581275e94f64dc773fe99662c9 to your computer and use it in GitHub Desktop.
const example with object.freeze
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 OBJ = { | |
prop1 : 1, | |
prop2 : 2, | |
propA : "A", | |
propB : "B", | |
}; | |
OBJ.prop1 = 3; | |
console.log(OBJ); | |
Object.freeze(OBJ); | |
OBJ.prop1 = 1; // nothing happens | |
console.log(OBJ); | |
// END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment