Yeah, I saw the difference. for_of is almost 20%-30% slower than forEach. It makes sense as Array.entries has to take an iteration to map out the index. I wonder why there's no native way of getting the index in for_of without a performance penalty🤔! for_of is so much more readable & mitigates the callback hell at least a little bit
Also I wouldn't really recommend anyone to use + instead of perseInt or parseFloat. Just mentioned as it is also doable too
Yeah, I saw the difference.
for_of
is almost 20%-30% slower thanforEach
. It makes sense asArray.entries
has to take an iteration to map out the index. I wonder why there's no native way of getting the index infor_of
without a performance penalty🤔!for_of
is so much more readable & mitigates the callback hell at least a little bitAlso I wouldn't really recommend anyone to use
+
instead ofperseInt
orparseFloat
. Just mentioned as it is also doable tooThank you so much for your corrections❤️
If you wanted an index to reference, but want to use
for...of
you'd be better off (performance wise) using a variable to track it.