Skip to content
dreamcode
dreamcode
Map
Object iteration
Lesson 20 of 48
+15 XP on finish
JAVASCRIPT CLIMBSChapter 4 · JS Collections Depth

Object Keys & Values

To loop over or inspect the properties of an object, use Object.keys() (returns an array of keys) or Object.values() (returns an array of values).

Worked example

How it reads

  • Object.keys(star) returns a list of string keys
  • Object.values(star) returns a list of property values
Cloud tip: These methods allow you to use array methods like .map() or .forEach() on object data.
index.js
JAVASCRIPT
real JavaScript, runs in your browser
Console
Run your code to see its output here.
YOUR TURN

Use Object.entries to log each stat on its own line as speed = 40 and temp = -10.

Press Run to check your work.