I don't think it's true that .map() and similar are faster than "traditional" loops. It's just more readable. However, difference is insignificant most of the time. But if you have a realy large array that you're iterating over, then do it un for loop.
As for comments... It's subjective, but I like "clean code" virw on this and like the code that does not need comments at all. So write descriptive variable/function names, break functionality in smaller parts, use readable code and avoid comments unless neccessary.
EDIT: to be more precise, map() was just an example but I was referring to all "new features to make our life easier". So in general, traditional loops are faster, but of course not always, faster than filter(), foreach(), etc. Not for your exact use case above. In example check: jsbench.me/5fizlui8g7
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 don't think it's true that .map() and similar are faster than "traditional" loops. It's just more readable. However, difference is insignificant most of the time. But if you have a realy large array that you're iterating over, then do it un for loop.
As for comments... It's subjective, but I like "clean code" virw on this and like the code that does not need comments at all. So write descriptive variable/function names, break functionality in smaller parts, use readable code and avoid comments unless neccessary.
EDIT: to be more precise, map() was just an example but I was referring to all "new features to make our life easier". So in general, traditional loops are faster, but of course not always, faster than filter(), foreach(), etc. Not for your exact use case above. In example check: jsbench.me/5fizlui8g7