A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/javascript-object-isextensible-method/ below:

JavaScript Object isExtensible() Method - GeeksforGeeks

JavaScript Object isExtensible() Method

Last Updated : 12 Jul, 2025

The Object.preventExtensions() method in JavaScript is a standard built-in object which checks whether an object is extensible or not(i.e. if we can add new properties to the object or not).

Syntax: 

Object.isExtensible( obj )

Parameters: This method accepts a single parameter as mentioned above and described below: 

Return value: This method returns a Boolean value indicating if the given object is extensible or not.

The below examples illustrate the Object.isExtensible() Method in JavaScript:

Example 1: In this example, we will check if new properties can be added to an object or not using the Object.isExtensible() Method in JavaScript. The output is a Boolean value.

javascript
const geeks1 = {};
console.log(Object.isExtensible(geeks1));
Object.preventExtensions(geeks1);
console.log(Object.isExtensible(geeks1));

const geeks2 = {};
Object.preventExtensions(geeks2);
console.log(
    Object.isExtensible(geeks2)
);  

Output: 

true
false
false

Example 2: In this example, we will check if new properties can be added to an object or not using the Object.isExtensible() Method in JavaScript. The output is a Boolean value.

javascript
let geeks1 = {};
console.log(Object.isExtensible(geeks1));
console.log(Object.preventExtensions(geeks1));
console.log(Object.isExtensible(geeks1));

let geeks2 = Object.seal({});
console.log(Object.isExtensible(geeks2));

let geeks3 = Object.freeze({});
console.log(Object.isExtensible(geeks3));

Output: 

true
[object Object]
false
false
false

We have a complete list of Javascript Object methods, to check those please go through this JavaScript Object Complete Reference article.

Supported Browsers: The browsers supported by Object.isExtensible() method are listed below: 



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4