Manipulating Complex Objects 2 object JSON

Manipulating Complex Objects 2 object JSON
0.0 0

#1

Tell us what’s happening:

creating 2 objects and two arrays…Stuck…Do I need to do[1] and so on added to my second object? Arrays?

Your code so far


var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CD",
      "8T",
      "LP"
    ],
    "gold": true
  }
  {
      "artist": "SOUP",
      "title": "Bart",
      "realease_year": 1982,
      "formats": [
        "CD",
        "Tape",
        "WAZOO"
        ],
        "gold": true
        }// Add record here
];

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

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


#2

Hint: How are elements in an array separated?


#3

0-9 starting at 0 [ using []


#4

var myMusic = [
{
“artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [
“CD”,
“8T”,
“LP”
],
“gold”: true
}
var myMusic[1] = [
{
“artist[1]”: “Dat Punk”,
“title[1]”: “Homework”,
“release_year[1]”: 1997,
“formats[1]”: [
“CD”,
“Cassette”,
“LP”
],
“gold[1]”: true
}
// Add record here
];


#5

Your first attempt is only missing a single character (the one that separates elements in the array). This array has two objects as elements, so you just need to add the separator between the two objects.

Check the following link if you are having trouble remember the separator character.
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/store-multiple-values-in-one-variable-using-javascript-arrays


#6

It was due to a comma they forgot in the lesson after the first array. I made it entirely too complicated. Thank you for your help. Onward I go.


#7

They did not forget to add the comma. You needed to put it in when you added your second object (album). An array with only one item (which is what the challenge started with), would not need a comma at the end.