Setting an ES6 class getter to enumerable
ES6 style getters are defined on the prototype, not on each individual person. To set the greeting property to enumerable you need to change: // Make enumerable (doesn’t work) Object.defineProperty(Person, ‘greeting’, {enumerable: true}); To: // Make enumerable Object.defineProperty(Person.prototype, ‘greeting’, {enumerable: true}); Object.keys only returns that object’s own enumerable properties, so properties on the prototype are … Read more