Tell us what’s happening:
How’s this?
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
userData?.songs.sort(a, b) => {...};
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Safari/605.1.15
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 29
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-string-and-array-methods-by-building-a-music-player/step-29`Preformatted text`
Teller
November 16, 2024, 5:43pm
2
Hi @Silverback
But for now, add an empty callback function to your sort() method and use a and b for the parameter names.
You should have an empty callback function ()=>{} inside your sort() method with a and b for the parameter names.
The parameters and call back function need to go inside the sort method.
The call back function need to be empty, so no dots.
Happy coding
This is not a correct callback function format. ((a, b) => {})
You need to have this
Hi there!
The .sort()
function is missing it’s last brace, also you need an empty callback function. You have added three dots within the callback function body.
Like this show examples as usual.
userData?.songs.sort(a, b) => ();Preformatted text
I did it, thanks for your help guys!
2 Likes