✨read-only proxy
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
JS ⟩ object ⟩ built-in ⟩ Proxy ⟩ example ⟩ read-only proxy
uses Proxy to create a read-only wrapper for an object.
replit ⟩ read-only proxy
// make an object read-only
function readOnly(o) {
// throw error when trying to set/add/delete property.
function throwError() {
throw new TypeError(`proxy object is read-only.`);
}