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

I don’t know what is wrong here. Challenge ask “Inside the userData object create a songs property. For the value, spread allSongs into an array”. When I put this, console said “SyntaxError: unknown: Unexpected keyword ‘const’. (83:2)”

The code of mine for now:
let userData = {
const songs = […allSongs];
};

Please help me.

yes, you can’t use const inside an object. For more help please post all your code and a link to the step

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-string-and-array-methods-by-building-a-music-player/step-9

Here’s the link to the step. tbh I still don’t get what to do.

you need to use the key: value syntax here, you are building an object

2 Likes

Oh, that’s a property. Got it. Many thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.