Manipulating Complex Objects Console.log

Tell us what’s happening:
How can I Show that array with console.log?

When I write:
console.log(myMusic[0]); //that show me [object Object]

How can I see the values?

I appreciate the help.

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": "Jon Bellion",
    "title": "Glory Sound Prep",
    "release_year": 2018,
    "formats": [ 
      "CD",
      "8T",
      "LP"
    ],
    "gold": true
  }
];

Your browser information:

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

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

you can see it or opening the browser console, or using JSON.stringify() inside the console.log around the thing you want to show in the fcc editor (it has some limitations), or using a different editor like repl.it

console.log(JSON.stringify(myMusic[0]));

1 Like

In the FCC editor I wrote console.log(myMusic[1]["title"]); and showed my the title propertie of the second object in the array. Is that ok? Is it a good practice?

Thank you for answering me so quickly.

In the Basic JavaScript: Accessing Nested Arrays Challenge I also found the answer to my problem.