Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScriptproperty descriptorsSingle-choice MCQ

When iterating with a for-in loop, the spec uses EnumerateObjectProperties. How are inherited enumerable properties and shadowing handled with respect to property descriptors?

const proto = { a: 1 }; Object.defineProperty(proto, 'b', { value: 2, enumerable: true }); const child = Object.create(proto); Object.defineProperty(child, 'b', { value: 3, enumerable: false }); let out = []; for (const k in child) out.push(k);