Tell us what’s happening:
Please I need help with this challenge:
You should check if a next song exists comparing userData.songs.length and currentSongIndex and set it to a nextSongExists constant. If the last index of the songs array (userData.songs.length - 1) is bigger than the currentSongIndex that means there is a next song.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
audio.addEventListener("ended", () => {
const currentSongIndex = getCurrentSongIndex(); })
const nextSongExists =
userData.songs.length -1 > currentSongIndex ? true : false;
})
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 96