Home / Javascript Tips Generated By ChatGPT / Preventing Object Modification in Javascript Prevent modifications to an object using Object.freeze. Source Code let obj = { name: 'John' }; Object.freeze(obj); obj.name = 'Jane'; // This will not work console.log(obj);