Object.entries / keys / values Playground

One cabinet read five ways at Bayu’s counter: Object.keys, values, entries, for...in and for...of. Do all five read the same drawers? The browser answers. An…

Why it matters

Reading an object is everyday work: rendering a form, transforming data, counting. Pick the wrong way and inherited keys sneak in, or the loop throws a TypeError. Object.entries with for...of is the safe loop: it destructures into [k, v] and maps easily.

The key idea

Object.* reads own drawers only, for...in climbs the prototype

Common mistakes

Try it in this playground