The Object propertyIsEnumerable() method
By Flavio Copes
Learn how the JavaScript propertyIsEnumerable() method checks whether a property exists on an object and is enumerable, returning true or false.
~~~
Called on an object instance, accepts a string as argument. If the object has a property with the name contained in the string argument, and that property is enumerable, it returns true. Otherwise it returns false.
Example:
const person = { name: 'Fred' }
Object.defineProperty(person, 'age', {
value: 87,
enumerable: false
})
person.propertyIsEnumerable('name') //true
person.propertyIsEnumerable('age') //false~~~
Related posts about js: