in new version of node or maybe in all(because i encountered it) we can not find index with the code you wrote which is this:
let index = songs.indexOf(currentSong.src.split("/").slice(-1)[0])
if ((index + 1) < songs.length) {
playMusic(songs[index + 1])
}
instead of that i suggest this for efficient and good finding because it always returns -1
suggested:
let songname = currentSong.src
.split("/")
.slice(-1)[0]
.replaceAll("%20", " ");
let index = songs.indexOf(songname);
console.log(songs, index, songname, songs.length);