DEV Community

Discussion on: The Most Useful JavaScript Array Methods Explained with Examples

Collapse
 
tfishr profile image
Tim Fisher

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.

Collapse
 
myogeshchavan97 profile image
Yogesh Chavan

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 🙂