Answers for "javascript Prevent Object MutationPassed"

0

javascript Prevent Object MutationPassed

let obj = {
  name:"FreeCodeCamp"
  review:"Awesome"
};
Object.freeze(obj);
obj.review = "bad"; //will be ignored. Mutation not allowed
obj.newProp = "Test"; // will be ignored. Mutation not allowed
console.log(obj); 
// { name: "FreeCodeCamp", review:"Awesome"}
Posted by: Guest on February-19-2021

Code answers related to "javascript Prevent Object MutationPassed"

Code answers related to "Javascript"

Browse Popular Code Answers by Language