I am unable to solve this step. To be honest I am unable to understand the step. I would like to know what the step wants me to do, and where am i going wrong. Thanks you again.
The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.
You will need to take an additional step here so the code you wrote presents in an easy to read format.
Please copy/paste all the editor code showing in the challenge from where you just linked.
Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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 87
i removed parentheses, also it is not about parentheses.
Also i did try to solve this with ternary operator but for some reason that is not correct answer.
My code so far.
To be honest the step does not provide sufficient detail. The step detail :
###Step 87
Notice that the album art in the HTML and songs in the userData.songs array have changed. We’ve swapped out the original songs for shorter ones that you can use to test your app in the upcoming steps.
Next, you need to check if there is a next song to play. Retrieve the current song index by calling the getCurrentSongIndex() function, and save it in a currentSongIndex constant.
After that, create a nextSongExists constant that contains the boolean value true or false depending on if the next song exists.
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.
this is checking if the length is equal to the currentSongIndex, if that the case you can’t have a current song as an array never has an item at an index equal to the length, you need to try to check if there is a next song in a different way
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
it’s not wrong to use the length, but you need to consider a different approach, like what is the last possible index after which there are no more songs?