Manipulating Objects Issues

Not sure what I did wrong, but also…Why this there a “,” at the end of the 2nd array, after they say in the instructions to not put one at the end.

Your code so far


var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CD",
      "8T",
      "LP"
    ],
    "gold": true
  }
  // Add record here
  {
    "artist": "Avenged Sevenfold",
    "title": "Waking the Fallen",
    "release_year": 2003,
    "formats": [
      "CD",
      "Cassette",
      "LP"
    ],
  }
];

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/manipulating-complex-objects/

You don’t need to put a comma after the last item, but you it won’t break anything if you do.

Wait, are you asking about the comma on line 10?

No the one on like line 20 at the very end of the second record.

“LP”
], <—that one.

With or without it though, my code is still not being accepted.

Your issue has to do with commas as well. myMusic is an array of objects, and items inside arrays are separated by commas. When you added an item in the code, you forgot to add a comma to separate it from the first item.

1 Like

Yes! That was it, I’m watching lots of videos trying to grasp all of this better. It’s starting to catch on. Thank you!