Object Keys Method
Multiple Choice Easy
Question
What does Object.keys({a:1,b:2}) return?
Hint
Object.keys returns property names.
Explanation
Object.keys({a:1, b:2}) returns ["a", "b"] — an array of the object own enumerable property names. Object.values() returns the values [1, 2], and Object.entries() returns [["a",1],["b",2]]. These are useful for iterating over objects.
Related Resources
Related Lessons
- Objects
Learn JS objects.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.