DEV Community

mhsohag11
mhsohag11

Posted on

Answer: How to prevent automatic sort of Object numeric property?

The simplest and the best way to preserve the order of the keys in the array obtained by Object.keys() is to manipulate the Object keys a little bit.

insert a "_" in front of every key name. then run the following code!

myObject = {
  _a: 1,
  _1:

Top comments (0)