const CONSTANT = Object.freeze({a: 1, b: 2});
Is it guaranteed that Object.values(CONSTANT)
will return [1, 2]
?
On MDN's doc, it says it follows for...in
which iterates in in original insertion order.
On some SO answers, it claims order is guaranteed for getOwnPropertyNames
but not for...in
.
Also, what implementation could they use to guarantee insertion order? If a sorted collection of some sort is used to track the order, wouldn't it result in O(log n) complexity for insertion/deletion of object properties?