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

I am being asked to to implicitly return Math.random() - 0.5

can someone help?

const shuffle = () => {
userData?.songs.sort(() => {Math.radom() - 0.5})

WARNING

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

Challenge Information:

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

Everything is correct except the curly brackets, they, re not needed here.

1 Like

I’ve been struggling with similar problems (and yes, also on this one) where the instructions are not teaching me anything. I had to run out to javascript - Why does adding {} to sort function change the answer? - Stack Overflow to find the answer. More care should be taken in these modules to teach students why we do something one way and not another. The only hint here is the “implicit” phrasing which helped me find the solution. I will note that once hired as SWEs we will be expected to find answers to questions like these on our own. I really recommend that the content owners of these courses consider teaching students how to find such answers and use resources such as MDN and W3 schools.
And I’m really confused why the module makers use such convoluted English phrasing as is found in many of the instructions.