- Instant help with your JavaScript coding problems
entries
The Object.entries() method returns an array of a given object's own enumerable string-keyed property [key, value] pairs. This is the same as iterating with a for...in loop, except that a for...in loop enumerates properties in the prototype chain as well.
JavaScript:
Object.entries(obj)
TypeScript:
entries(o: { [s: string]: T } | ArrayLike): [string, T][];
Examples:
const obj = { foo: 'bar', baz: 42 };
console.log(Object.entries(obj)); // [ ['foo', 'bar'], ['baz', 42] ]

Related snippets