Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
You have an object, objects in js have random access, and although most often object keys go in the order of addition, no one can guarantee this!
What can be done? - get an array of keys of this object and sort this array according to property values:
var keys = Object.getOwnPropertyNames(obj.position);
keys.sort((a, b) => obj.position[a] - obj.position[b]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question