Tell us what’s happening:
Step 25
Now, create a function named getNextSong. Make it return the song that can be found at getCurrentSongIndex() plus one in userData.songs, or undefined if the current song is the last one in the playlist.
I need to get my getNextSong function to return the song right next to the current song, presumably by adding 1 to the getCurrentSongIndex(). I don’t know how to do this. Here is the code:
function getNextSong () {
return getCurrentSongIndex(userData.currentSong + 1);
}
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function getNextSong () {
return getCurrentSongIndex(userData.currentSong + 1);
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Challenge Information:
Build a Music Player - Step 25