lodash/lodash — pull request #683 by jeremymoritz (2014-08-24 00:50:30+00:00)
Title: todo comment about fixing _.forEach bug

Discovered a bug that occurs when an array is altered by the callback function provided to _.forEach

Here is an example that will demonstrate the bug:

[CODE]

var elements = ['a', 'b', 'c', 'd', 'e', 'f'];
_.forEach(elements, function eachElement(el) {
console.log(el + ': will now be removed from the array');
_.pull(elements, el);
});
console.log('the final version of the array is: ' + elements);

[/CODE]

The expected outcome is an empty array, but instead the elements array becomes ['b','d','f']