JavaScript Object propertyIsEnumerable() method
determines whether the specified property is this object's enumerable own property

Object.propertyIsEnumerable() method determines whether or not a property is enumerable.

A property created via a simple assignment or a property initializer is enumerable.

A property is enumerable if it has the enumerable attribute set to true.

A property is NOT enumerable if it has the enumerable attribute set to false.

syntax

propertyIsEnumerable(prop)

prop The name of the property to test. Can be a string or a Symbol

enumerable attribute determines whether or not a property is accessible when the object's properties are enumerated using the for...in loop or Object.keys() method.

Object.propertyIsEnumerable() method returns true if property is enumerable and is the object's own property.

All objects that inherit from Object.prototype inherit the Object.propertyIsEnumerable() method.

Object.propertyIsEnumerable() method determines if the specified property, string or symbol, is an enumerable own property of the object. If the object does not have the specified property, this method returns false.

Most built-in properties are non-enumerable by default, while user-created object properties are often enumerable, unless explicitly designated otherwise.

Only enumerable own properties cause Object.propertyIsEnumerable() to return true, although all enumerable properties, including inherited ones, are visited by the for...in loop.

myObject

// create an object | myObject

const myObject = {}

// define multiple properties for myObject object

Object.defineProperties(myObject, {

item: {

value: "shirt",

enumerable: true, // true

},

color: {

value: "blue",

enumerable: false, // false

},

price: {

value: 19.99,

enumerable: true, // true

},

qty: {

value: 41,

enumerable: false, // false

},

})

syntax description
determine whether the specified property is myObject's enumerable own property
myObject.propertyIsEnumerable(property)