I almost never want to unconditionally visit every item in an array. forEach() takes away break, continue, and return. I almost always want to use these inside the loop. They're 10x more useful than forEach(). In fact I avoid forEach() even when I don't need break, continue, and return, just in case I need them later. I'll stick with for, but map, reduce, find, filter are all extremely useful. I wish they were in Set too.
I almost never want to unconditionally visit every item in an array. forEach() takes away
break
,continue
, andreturn
. I almost always want to use these inside the loop. They're 10x more useful than forEach(). In fact I avoid forEach() even when I don't needbreak
,continue
, andreturn
, just in case I need them later. I'll stick withfor
, butmap
,reduce
,find
,filter
are all extremely useful. I wish they were inSet
too.That's true. except
forEach
, all other methods are really useful.forEach
is not used much but knowing how to use all of them is good to know.Thanks for your point of view regarding it 🙂