Doubt on object in js

Tell us what’s happening:
I tried this code. its working but, when I tried for"console.log(“artist”) its showing “Deep Purple”.
suppose i want to “Billy Joel”,
how to get it.

Your code so far


var myMusic = [
{
  "artist": "Billy Joel",
  "title": "Piano Man",
  "release_year": 1973,
  "formats": [
    "CD",
    "8T",
    "LP"
  ],
  "gold": true
},
{"artist": "Deep Purple",
  title: "Smoke on the water",
  release_year: 1976,
  formats: ["CD", "8T", "LP"]
}
];
console.log(myMusic[1]["artist"]);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Safari/537.36.

Challenge: Manipulating Complex Objects

Link to the challenge:

Hey @anusai29102000,

Remember that JavaScript Arrays are 0-index (zero-indexed), that means, when you are trying to access the first item inside an array or objects, it’s going to be 0, then the second object will be 1 and so on. So myMusic[1] will access the second one. Try myMusic[0]. Learn more about zero-indexed javascript here:

Array has a 0 index predictable order if used with numeric default keys.
Object keys order on the other hand is unpredictable.
The informations I have added are a little bit off topic but good to know.