I have to return the array of the key-value pairs of object via a method. I'm using Object.entries(), but it changes the order of properties(in example you can see that numerical property is moved to the first place in returned array).
Object.toPairs = function (obj) {return Object.entries(obj);}
var aloha = {
this: 'is',
not: 'so',
hard: 'really o_O ?!',
a: 'xxx',
1: '-----',
};
Object.toPairs(aloha)
result is
[ [ '1', '-----' ], [ 'this', 'is' ], [ 'not', 'so' ], [ 'hard', 'really o_O ?!' ], [ 'a', 'xxx' ] ]
How can it be properly solved?