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

Tell us what’s happening:

Very confusing. It is asking me to create a FUNCTION by using CONST. But CONST is what makes a variable… and FUNCTION is what creates a FUNCTION.

Using CONST does not pass. I did not forget about the ‘id’ needing to be the argument, I am just trying to figure out what the correct syntax is. I have not seen a CONST FUNCTION before but it seems that it what it is asking for.

Your code so far

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

/* file: styles.css */

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

function playSong() {};

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

Challenge Information:

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

Hi @LowVel0city !

The lesson wants you to create an arrow function and assign that to a const variable.

A few lessons earlier, you learned how to work with arrow functions.
Then there was a lesson showing you how to assign that to a variable.

here is an example of an arrow function assigned to a const variable called sortSongs

const sortSongs = () => {
  userData?.songs.sort((a,b) => {
    if (a.title < b.title) {
      return -1;
    }

    if (a.title > b.title) {
      return 1;
    }

    return 0;
  });

  return userData?.songs;
};

hope that helps

here are the lessons going through arrow functions

Ah, solved in seconds once being told it is looking for an arrow function.

Below is what it asks of me:

It does not mention that it is looking for me to create an arrow function, just a function. Quite a few steps have been misleading and unclear in this section.

image

1 Like

Yeah, it could be rewritten as “Create a new named arrow function called playSong” or something along those lines

1 Like