javascript: why need to delete the 0 index of an array
javascript, underscore.js
Solution
Searching around in the Issue tracker shows that my assumption was right, it is just a fix for an IE bug.
IE bugs with splice() and shift():
jdalton commented on 6 Dec 2011 IE bugs with splice() and shift(), failing to remove the 0 indexed value, when using an array-like-object with _(...). IE compatibility mode and IE < 9 have buggy Array shift() and splice() functions that fail to remove the last element, object[0], of array-like-objects even though the length property is set to 0.
Problem
in underscore source code, after applying shift or splice on an array and in case the length of the array is zero : ``` if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; ``` any idea why still need to do this : `delete obj[0]`