When you declares arr = [ ] you are saying that exist and empty array. Remember that and array consist in several values in a list, then when in the loop you say arr[i] = undefined, you are saying that that position exist in de array, but is empty, think it as the diference to make a empty list:
THINGS TO DO:
And make a list with points to anote those things:
Things to do
In the second case you are creating those “positions” even if you let empty, the marker exists