Stuck on this step:
Step 36
Before you start working on playing the next and previous song, you need to get the index of each song in the
songs
property ofuserData
. Remember this is where you spread in the songs.Use an arrow syntax to create a
getCurrentSongIndex
function. Then, using implicit return, use theindexOf()
method onuserData?.songs
, and pass inuserData.currentSong
.Calling this function will get you the index of each song.
Here’s what I’m doing, could someone help me out? Thank you!
const getCurrentSongIndex = () => (
userData?.songs.indexOf(userData.currentSong)
);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 36