Basic JavaScript - Manipulating Complex Objects

What do they mean by two elements?
I have used bracket notation to add objects to myMusic. I do not seem to understand what they mean by adding two elements. do i create another variable inside of myMusic? Please elaborate

Your code so far

const myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [
      "CD",
      "8T",
      "LP"
    ],
    "gold": true
  }
  
  

];
myMusic["artist"]="Aaliyah";
myMusic["title"]="I Care 4 U";
myMusic["release_year"]=2000;
myMusic["formats"]=["CD", "8T", "LP"];
console.log(myMusic);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/107.0

Challenge: Basic JavaScript - Manipulating Complex Objects

Link to the challenge:

hi there, can you post a quote of what it is you are reading? I can’t find the “two elements” you are referring to in the link you’ve posted.

Edit: nevermind, found it. You were talking about the test cases:

  • Waiting:myMusic should have at least two elements
  • Waiting:The elements in the myMusic array should be objects

The elements are objects inside the myMusic array.
For eg. in the exercise they show you this:

const ourMusic = [
  {
    "artist": "Daft Punk",
    "title": "Homework",
    "release_year": 1997,
    "formats": [ 
      "CD", 
      "Cassette", 
      "LP"
    ],
    "gold": true
  }
];

This is an array of 1 object (or 1 element as per the test case).
You will need to add a new album just like the one shown here so that the array has 2 elements instead of just one.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.