Im not sure Im getting what is being asked, this seems to be a property for all songs. I tried songs = "allSongs"; but that did not work, I also tried songs = ["allSongs"]; and alas tried songs = allSongs; so here is another try, and it still doesn’t work… Any ideas?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
let userData = {
songs = "...allSongs";
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 9
I too was struggling with this step, specifically the syntax. I understood the concept/idea of what was being asked but I couldn’t find the right way to format my answer. Here is what helped.
let userData = {
songs = (This part I couldn’t get right)
}
I tried a bunch of versions, …allSongs in quotes, with the array markers at the end , and combinations thereof. I think what solved my issue was defining songs as an array of allSongs without any other punctuation […allSongs].
I think I was missing that allSongs is a variable defined in the step prior, so the … in combination with the variable should create a list of all of it’s items?
I don’t think anything more needs to be defined, you have 99% of the code correct. I could be wrong, the only issue I see is how you’ve formatted the bit after the “songs”. I think if you adjust the = sign (I think it might be a colon instead, but I’m not 100% sure), and the quotes around …allSongs into the array brackets it should work.
let userData = {
songs = “…allSongs”;
}
the syntax of this should be
let variableHere = {
property: [value]
}
Where in this case we would use around the value because we want to pass in the array of all songs?
I think it’s very close, try removing the quotes from allSongs. If you leave it in quotes you’re telling it that songs is equal to the text “…allSongs”, where you really want to tell it songs is equal to the array of the song names from the variable allSongs.
Very close, just with the semi-colon after the last } instead of after the ]? The semicolon is used in a different context (I think) where in this context each line is separated by a comma. Since there is only one line, I don’t know you need a comma. The semi-colon outside the bracket at the end is needed because it’s the end of the function (IIRC)
I see the issue, my reply missed it. The “=” sign should be a colon “:” separating songs and […allSongs] , code above is edited to reflect the correction.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
I’m sure this explanation isn’t technically super accurate, but the ; is outside the } because it’s ending the let userData statement, it’s not ending the definition within the { } which is where you’re stating the songs property of the userData object is equal to the array (list) of all songs.
I understand posting solutions isn’t the way. How would you suggest I have replied instead? I did try to explain the error and why it was not working from a conceptual standpoint, however, it’s a bit tricky considering I have a limited knowledge.