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

const shuffle = () => {
userData.songs.sort(() => Math.random() - 0.5);
};

I’ve become lost. Help, please.

1 Like

Hi there!
Post a link to the challenge step.

Isn’t the link at the top of the post, the title? It seems ‘hot’ when I click it, but try this:

Your code doesn’t seem to use optional chaining. In other words, it’s missing the ? in userData.songs. Making it userData?.songs should fix it. :grin:

Thanks for pointing to my mistake.

1 Like