Tell us what’s happening:
.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.
Hi please help me to rectify my mistake on my last constant
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
audio.addEventListener("ended", () => {
const currentSongIndex = getCurrentSongIndex();
const nextSongExists = ususerData.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/140.0.0.0 Mobile Safari/537.36
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 96