Replace _.each and _.forEach with array.forEachpro

Replace Lodash _.each and _.forEach with array.forEach.

Refactoring (Convert)
Modernization
ES5
P42 for VS Code
P42 for GitHub
Pro & Business
Replace _.each and _.forEach with array.forEach

Why is this refactoring helpful?

You can express many _.each and _.forEach calls with standard JavaScript. This refactoring reduces the dependency on Lodash.

What do I need to consider?

Lodash _.each and _.forEach iterate over array-like collections (i.e., non-arrays with a .length property) as if they are arrays. This can lead to differences between _.forEach and the JavaScript Array.forEach.

Configuration

Related Code Assists

Learn More

Available In