rfcs
rfcs copied to clipboard
each vs each-in
trafficstars
See existing behavior of each vs each-in
Is there a good reason to not have each just... do everything?
- handle non-arrays (call .entries() or Object.entries())
- continue to yield out the index as the last param (each-in does not do this)
just the same reasoning you don't have .forEach on Object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object they are different, do different things as you pointed out one of them doesn't have indexes you can pretend it does, but only a derived state like entries has them as that is not guaranteed to be stable other examples for..in and for..of they are separate things