Skip to content
Justice Tech School

Object.keys, values, entries and assign

Object.keys, values and entries list properties. Object.assign and spread copy and merge objects. Object.fromEntries builds an object from pairs.

Example
const o = { a: 1, b: 2 };
console.log(Object.keys(o), Object.values(o), Object.entries(o));
console.log({ ...o, c: 3 }, Object.fromEntries([["x", 1]]));

Exercise

List the keys.

Object.(o)

Quiz Test

What does Object.entries return?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.