Hi,
I'm a bit wondering why the order of the parameters are kinda reversed on object iteration. If there's any reason why the order is in this way, it would be helpful if you can share your thoughts in order for me and potentially others to avoid relevant mistakes and such.
Currently when you iterate over object, you will get key, (or property name) as the first argument:
But if we consider key to be more like index, the following order is a bit more consistent compared to other types, where val is always passed as first argument.
Hi, I'm a bit wondering why the order of the parameters are kinda reversed on
object
iteration. If there's any reason why the order is in this way, it would be helpful if you can share your thoughts in order for me and potentially others to avoid relevant mistakes and such.Currently when you iterate over
object
, you will getkey
, (orproperty name
) as the first argument:But if we consider
key
to be more like index, the following order is a bit more consistent compared to other types, whereval
is always passed as first argument.underscore.js
andlodash.js
are passingval
in the first parameter: