4 ms·
In js, are obj field names stable on insertion? Normally I wouldn't expect getOwnPropertyNames to return them in the same order.
by phillmv 11y ago
In js, are obj field names stable on insertion?
Normally I wouldn't expect getOwnPropertyNames to return them in the same order.
- dagw 11y agoAccording to the spec, no guarantee of order is made. The latest spec even adds separate a Map object that does make that guarentee: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- inglor 11y agothe order is guaranteed. https://esdiscuss.org/topic/property-ordering-of-enumerate-getownpropertynames https://esdiscuss.org/topic/property-ordering-of-enumerate-g...