JavaScript · Senior · Question 20 of 75

In what order will Object.keys return the keys of { b: 1, 2: 1, a: 1, 1: 1 }?

Explanation

Integer keys come first in ascending order, then string keys in insertion order, then symbols (which Object.keys doesn't return). If order matters for numeric keys, use a Map.

Further reading

Problem with a question

JavaScript · Senior · question 20

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz