Possible bug in step 96/97 of Learn Basic String and Array Methods by Building a Music Player (JS Beta certification)

On step 96 I add the following code and pass the step:

audio.addEventListener("ended", () => {
  const currentSongIndex = getCurrentSongIndex();
  const nextSongExists = (userData.songs.length - 1) > currentSongIndex ? true : false;
});

Then on step 97 I see that the code for nextSongExists has been replaced by this:

const nextSongExists = userData?.songs[currentSongIndex + 1] !== undefined;

How are the two same?

Yes they are functionally the same but I do think it may be confusing to write one thing and have it magically change. Can you report this on GitHub?

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.