Thursday, January 22, 2026
HomeLanguagesJavascriptJavaScript TypeError – Can’t delete non-configurable array element

JavaScript TypeError – Can’t delete non-configurable array element

This JavaScript exception can’t delete non-configurable array element that occurs if there is an attempt to short array-length, and any one of the array’s elements is non-configurable.

Message:

TypeError: can't delete non-configurable array element (Firefox)
TypeError: Cannot delete property '2' of [object Array] (Chrome)

Error Type:

TypeError

Cause of error: When one of the array’s elements is non-configurable and code tries to shorten the length of the array.

Example 1: In this example, the array properties are non-configurable and an attempt was made to delete the property by shortening the array length. 

Javascript




let array = [];
Object.defineProperty(array, 1, { value: 4 });
Object.defineProperty(array, 2, { value: "4" });
array.length = 1; // Error here


Output:

TypeError: can't delete non-configurable array element

Example 2: In this example, the array properties are non-configurable and an attempt was made to delete the property by shortening the array length. 

Javascript




let array = ['a', 'b', 'c'];
Object.seal(array);
array.length = 1; // Error here


Output:

TypeError: can't delete non-configurable array element
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS