Tell us what’s happening:
Hello. There is a problem in my code. Please help me. The bottom and right developer console says: Sorry, your code does not pass. You’re getting there.
You should assign array.map()
to your songsHTML
. // running tests
2. You should assign array.map() to your songsHTML.
// tests completed
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const songsHTML = songs.map(song => {
return ` <div class="song" id="${song.id}"> <h3>${song.title}</h3> <p>Artist: ${song.artist}</p> <p>Duration: ${song.duration}</p> <button class="delete-button" onclick="deleteSong(${song.id})">Delete</button> </div> `;
});
// 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/128.0.0.0 Safari/537.36 OPR/114.0.0.0
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 18
const renderSongs = (array) ← use array.map instead of songs.map
Is it should be so?
const renderSongs = (array) => {
return array.map(song => {
return ` <div class="song" id="${song.id}"> <h3>${song.title}</h3> <p>Artist: ${song.artist}</p> <p>Duration: ${song.duration}</p> <button class="delete-button" onclick="deleteSong(${song.id})">Delete</button> </div> `;
}).join('');
};
But the developer console writes again: // running tests 1. You should have a
const
variable called
songsHTML
. 2. You should assign
array.map()
to your
songsHTML
. // tests completed
sorry if I confused you. I was just pointing to that it want you to use array.map() not songs.map();
You were doing it almost right before.
const songsHTML = array.map();
it doesn’t want you to do the callback yet. That is step 19
Hi there!
The instructions is asking you: Start by using const
to declare a variable named songsHTML
and assign it array.map()
.
you are returning the array.map()
in the songs.map()
method stored in the songsHTML
variable with a song
parameter and a callback function and using logic. Remember, if you didn’t follow the instructions, your code will not pass for the challenge. though, if it is correct code.
Reset the challenge step and exactly follow the instructions.
1 Like