There are other ways (forEach for example) but as I know they are usually 'slower' so I always use for :)
I think that depends on how much data you're processing. If it's a massive amount, then you may notice it to be a bit slower, but generally the discrepancy is so minimal that it's inconsequential. v8 is actually greatly optimised to use forEach. This is a great talk on the subject by Mathias Bynens: youtube.com/watch?v=m9cTaYI95Zc
So, IMO, it's a far nicer developer experience to use forEach or for of/in in certain cases.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think that depends on how much data you're processing. If it's a massive amount, then you may notice it to be a bit slower, but generally the discrepancy is so minimal that it's inconsequential. v8 is actually greatly optimised to use
forEach
. This is a great talk on the subject by Mathias Bynens: youtube.com/watch?v=m9cTaYI95ZcSo, IMO, it's a far nicer developer experience to use
forEach
orfor of/in
in certain cases.