I'm creating a playlist system where each song has a unique ID. When you add a song to the playlist array, its index is registered as its ID.

Normally when looping over a javascript array, you grab the length and count up through the index. Is there a way to loop through an array with unused indexes? Is that bad practice for any reason?