Akash Mittal

Akash Mittal

記事一覧

TypeError: can't define property "x": "obj" is not extensible - JavaScript

In JavaScript we can prevent an Object to add any new property. We achieve this using Object.preventExtensions() function. This is used to prevent changes in th…

Akash Mittal
1年前

TypeError: can't define property "x": "obj" is not extensible - JavaScript

In JavaScript we can prevent an Object to add any new property. We achieve this using Object.preventExtensions() function. This is used to prevent changes in the Object. Here is a code example - const object1 = {};Object.preventExtensions(