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

Tell us what’s happening:

It is supposed to be a straightforward task but I am getting errors It’s my second day, couldn’t solve it, Is it some kind of bug or is there an actual error? If anyone of you guys solve it please help

### Your code so far

const setPlayButtonAccessibleText = () => {

const song = userData?.currentSong;

};

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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36

Challenge Information:

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

the first song in the userData?.songs array

How would you access the first element of an array? Any array?

Ah, ok I think I see the issue now. If you open the console it will show a bit more info, but…

It’s asking you to use an OR operator. Not to set the variable to this or that, but use both values in an OR operator

i wrote like below but not succeed

const setPlayButtonAccessibleText = () => {
const song = userData?.songs[0];
};

OR
const setPlayButtonAccessibleText = () => {
const song = userData?.currentSong ;
;
};

More like in this ‘console.log’ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR

console.log(a > 0 || b > 0);

Open the console, click console in the upper left

1 Like

Now its working,
Thanks ,I understood it wrongly it was supposed to be like this

2 Likes

You got it :+1: but please don’t post the solution code in the forum

1 Like