JavaScript Algorithms and Data Structures (Beta) Learn Basic String and Array Methods by Building a Music Player Step 19

Pass in a callback function to the map() method. The callback function should take song as a parameter, use the arrow function syntax, and have an empty body.

const songsHTML = array.map((song) => {});

The callback function of your map() method should use arrow function syntax.

I don’t know why can’t get past this step, I have tried everything.
Someone should help look into it.

Can you link to the lesson and specific step you are on when creating a post about a specific project issue? It will help others to better help you.

I do not see any issues with that, it looks like it should pass. You should try using the ‘reset lesson’ button (it will only reset the current step you are on) and try again. You could also see if it accepts song as the parameter without the parantheses (this is only valid when you have exactly one parameter).

[Learn Basic String and Array Methods by Building a Music Player] Step 19

const songsHTML = array.map((song) =>  {});

The callback function of your map() method should use arrow function syntax.

It seems everything is fine but i can’t get past this step

const songsHTML = array.map(song => {});
is not necessary use () around song

I have done that, it is still not working

Hey there!
Welcome to the FCC forum. Please link your topic to the challenge step, that’s you asking about.

Thank you for your response, I have included the link below

here is the link to the step

  const songsHTML = array.map();

Above is the original code of this challenge step. Now you need a song parameter (song) within your map() method and aero => Syntex and a empty pair of brackets {}. This called call back function.
@oyelajakenny

Thank you for your feedback @hasanzaib1389.

I have done that, but it is not working.
I have been on this since 4 days ago

  const songsHTML = array.map(song => {});

I just tried your recent code, and it passes on my end.

Try resetting the lesson and trying again.
Or you can move to the next lesson

1 Like

It still did not pass after resetting, perhaps I have done that several times.

Find the console output below.

I will proceed to the next step

SyntaxError: unknown: Identifier 'songsHTML' has already been declared. (91:10)

  89 | const renderSongs = (array) => {
  90 |   const songsHTML = array.map();
> 91 |     const songsHTML = array.map(song => {});
     |           ^
  92 | };
  93 |

You can’t declare songsHTML twice.
You can’t do that with a const variable or let.

You should only have this

hope that clarifies

Here is an article to better understand how const and let works

It will explain why you can’t do what you are trying to do and why there is a syntax error.

Now if you use var (which is not taught in this course), then this would be valid and would not throw an error

 var songsHTML = array.map();
 var songsHTML = array.map(song => { });

the article goes into how all of this works in more detail.
hope that helps

1 Like

Thank you for the clarification

1 Like

Yes, it does @jwilkins.oboe

1 Like

It helped me Thanks mam

1 Like