A RetroSearch Logo

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

Search Query:

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

JavaScript Object propertyIsEnumerable() Method - GeeksforGeeks

JavaScript Object propertyIsEnumerable() Method

Last Updated : 15 Jul, 2025

The propertyIsEnumerable() method returns a Boolean indicating whether the specified property is enumerable and is the object's own property. The propertyIsEnumerable() method returns false if the object doesn't have the specified property.

Syntax:

obj.propertyIsEnumerable(prop)

Parameters: This method accepts a single parameter.

Return value: This method returns a boolean value.

Example 1: This example shows the basic use of the JavaScript Object.prototype.propertyIsEnumerable() method.

javascript
<script>
    const obj = {};
    const arr = [];
    obj.property = 42;
    arr[0] = 42;
    
    console.log(obj.propertyIsEnumerable('property'));
    console.log(arr.propertyIsEnumerable(0));
    console.log(arr.propertyIsEnumerable('length'));
</script>

Output:

true
true
false

Example 2: The following example illustrates the enumerability of user-defined vs. built-in properties:

javascript
<script>
    let a = ['is enumerable'];
    
    console.log(a.propertyIsEnumerable(0));         
    console.log(a.propertyIsEnumerable('length'));   
    
    console.log(Math.propertyIsEnumerable('random'));  
    console.log(this.propertyIsEnumerable('Math'));     
</script>

Output:

true
false
false
false

We have a complete list of Javascript Object Methods, to check those please go through the Javascript Object Complete Reference article.

Supported Browser:



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