On Tue, Apr 24, 2018 at 4:06 PM, David Teller <[email protected]> wrote: > > Doing this sounds pretty fragile. Do you have any guarantee that the > order of fields is the same as the order of the array? Even if that's > the case in your scenario, it's pretty uncommon.
If we make a couple of assumptions: 1. He's adding the properties to a newly-created object in array order 2. None of the keys is an [integer index][1] ...then yes, the order is guaranteed (even for `Object.keys`, nowadays -- that wasn't true in ES2015, not sure when it changed and the ECMA site is down so I can't check the 2016 or 2017 snapshots [note to self: keep local copies!]). Agreed it's not the best way to go about it, though. :-) -- T.J. Crowder [1]: https://tc39.github.io/ecma262/#sec-object-type _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

