[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Errors/Cant_delete [Back]  [Original]

TypeError: property "x" is non-configurable and can't be deleted - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

TypeError: property "x" is non-configurable and can't be deleted

TypeError: property "x" is non-configurable and can't be deleted. (Firefox)
TypeError: Cannot delete property 'x' of #<Object> (Chrome)

TypeError

configurable writable

false

Object.defineProperty() Object.freeze()

js
"use strict";
var obj = Object.freeze({ name: "Elsa", score: 157 });
delete obj.score; // TypeError

("use strict");
var obj = {};
Object.defineProperty(obj, "foo", { value: 2, configurable: false });
delete obj.foo; // TypeError

("use strict");
var frozenArray = Object.freeze([0, 1, 2]);
frozenArray.pop(); // TypeError

JavaScript

js
"use strict";
delete Math.PI; // TypeError


Web Proxy Viewer  |  New URL  |  Original Page