Consider the following code:
const obj = { 'a': 1, 'b': 2, 'c': 3 };
const keys1 = Object.keys(obj);
const keys2 = Object.keys(obj);
Am I guaranteed that the elements of keys1
will be in the same order as those in keys2
?
Will Object.keys()
always return keys in the same order if called on an object which remains unmodified between calls (assuming both calls are performed in the same environment)?
My question is similar to the question asked here about dictionary behavior in Python.