Enumerable properties in JavaScript are properties of an object, that can be iterated over in the
for in
loop or Object.keys
function.Here's an example:
const object = {
Hello: 'World!',
Mary: 'Jane'
};
// This will output:
// Hello World!
// Mary Jane
for (const key in object) {
console.log(key, object[key]);
}
// Although this object also has other, built-in,
// non-enumerable properties, such as:
console.log(object.constructor); // ƒ Object() { [native code] }
console.log(object.toString); // ƒ toString() { [native code] }