Learn Basic String and Array Methods by Building a Music Player - Step 96

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

what do you need the ternary for?

Hi, what are you implying by that?

I am asking, you are using it to return true or false. Do you know what the operator > returns?

it’s not exactly where your issue is, but it’s quite redundant

Thank you for helping me to rectify my mistake, I have been really fatigue lately.