LearnFrenzy
Sign in Take a free test

Loops · JavaScript Loops MCQ · Question 9

Order of object keys Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 9 Back to Exercise

In which order does Object.keys({ z: 1, 5: 2, a: 3, 1: 4 }) return the keys?

  • A "z", "5", "a", "1"
  • B "1", "5", "z", "a" Correct
  • C "a", "z", "1", "5"
  • D The order is random
Correct Answer: Option B

Integer-like keys come first in ascending numeric order, then the remaining string keys in insertion order.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links