documentcloud/underscore — pull request #1128 by liuyl (2013-05-25 04:16:17+00:00)
Title: Respect holes

Check if the element really exist in the array in `_.each` function.
Like

var numbers = [1,2,3,4,5],
counter = 0;
delete numbers[2];
numbers.forEach(function(){ counter++; });

in IE10, Firefox20, Chrome26, the value of counter is 4 because the element numbers[2] does not exist. And there is a test case in google v8 engine called '[respect holes](https://code.google.com/p/v8/source/browse/branches/bleeding_edge/test/mjsunit/array-iteration.js#61)'.
Also in [ECMA-262 15.4.4.18](http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf),

_callbackfn_ is called only for elements of the array which actually exist; it is not called for missing elements of the array.

But the underscore's implementation of `_.each` didn't do this check.

Same bug also exist in the `_.object` function. I fixed this, and add two unit test case.