✨guard against accidental modifications
an object without prototype.
// the object to protect
const _protected = {
data: 'DO NOT CHANGE THIS!',
};
// ⭐ guard against accidental modifications
const inherited = Object.create(_protected);
// ⭐ this modifies `inherited` itself, not the `protected` one.
inherited.data = 'Hello, World.';
inherited.data, // 'Hello, World.'
_protected.data, // 'DO NOT CHANGE THIS!'Last updated