How does Array.prototype.sort handle undefined values in an array?
Array.prototype.sort
var array = [1,undefined,2,undefined,3,undefined,4]; var array2 = []; array2[
all undefined values will go to the end of the array regardless of their order in declaration. (at least this is how it works in chrome's js engine)