The Object.freeze()
method freezes an object, preventing new properties from being added, existing properties from being removed, or their values from being changed.
Example:
const obj = { name: 'John' };
Object.freeze(obj);
obj.name = 'Jane'; // This won't change the name
Tags: basic, JavaScript, objects
URL: https://www.tiktok.com/@jsmentoring/photo/7457554518977285408