Tell us what’s happening:
I am stuck on step 36, I have followed the requirement, but it is not passing the test. The code seems right to me.
### Your code so far
const getCurrentSongIndex = () => {
userData?.songs.indexOf(userData.currentSong);
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 36
1 Like
You need an implicit return, the way you structured it requires a return
statement.
Try it on 1 line with no curly braces
3 Likes
Perfect! Thank you for the help on my solution, @pkdvalis !
Some additional info for clarification:
The braces can only be omitted if the function directly returns an expression. If the body has additional lines of processing, the braces are required — and so is the return
keyword. Arrow functions cannot guess what or when you want to return.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
https://www.freecodecamp.org/news/javascript-arrow-functions-in-depth/
1 Like
system
Closed
June 26, 2024, 2:19pm
5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.