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

Tell us what’s happening:

Tldr: I already solved the step, but would like further answers.
Why is it can’t be:
songsHTML = playlistSongs.innerHTML

The question said:
Assign songsHTML to the innerHTML property of the playlistSongs element,
This could be just a misunderstanding, but a detailed answer about why is it would be greatly appreciated.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

`songsHTML = playlistSongs.innerHTML`

// 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/127.0.0.0 Safari/537.36

Challenge Information:

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

There are a few reasons. Let’s start with the actual request which said:

I’m being asked to assign something TO something.
Since TO means the end destination is innerHTML of the playlistSongs, then this should go on the left side of the equal sign. (Say you wrote x = 10 then you are assigning 10 TO x and the end destination of 10 is the variable x)

Another reason quite frankly is the goal of this step which is stated as:

Next, you will need to update the playlist in your HTML document to display the songs.

In order to update the HTML document, you need to modify something in the HTML. therefore innerHTML is more likely to do that than updating the value in a variable (songsHTML) which would not affect the HTML of the document.

3 Likes

I see. A very detailed explanation as always. No room for questions.
Thank you very much!

1 Like