I ran into the oddest behavior while working on a ticket this morning. If you see below after running Object.keys
, the order of the keys has changed leaving P
after F
.
I tried the following:
Object.entries
- got the same result asObject.keys
For loop
- got the same result asObject.keys
- I thought perhaps that the
#
was throwing off the sorting, so I removed it and re ran the test. - got the same result asObject.keys
I looked at the ECMAScript spec and this should not be case. Any ideas what could be causing this behavior ?
P.S I fixed the issue by running .sort() on the array but was curious to know what's causing the keys to go out of order.