Skip to content

writable

If writable is true, the property’s value can be changed; otherwise it is read‑only.

const obj = {};
Object.defineProperty(obj, "x", { value: 10, writable: false });
obj.x = 20; // ignored or error in strict mode
console.log(obj.x); // 10