Manipulating Complex Objects - (myMusic should have 2 elements)

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**
const myMusic = [
  "artist": "Billy Joel",
  "title": "Piano Man",
  "release_year": 1973,
  "formats": [
  "gold": true

myMusic["artist"] = "Drake"
myMusic["title"] = "Lover Boy"
myMusic["release_year"] = 2021
myMusic["formats"] = ["Spotify", "Apple Music", "YouTube"]

  **Your browser information:**

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

Challenge: Manipulating Complex Objects

Link to the challenge:

Your code here says get me an object called myMusic and add the property artist to it which should be set to Drake.
However, there’s no object called myMusic, there’s only an array called myMusic which contains objects carrying details of an album.
The challenge’s is requesting that you create a second object containing details of an album in the myMusic array, something like this:

const albumArr = [
first album object
second album object
third  album object

1 Like

Did you see the output of the console.log? Did you see how your code didn’t add one new object to the myMusic but rather properties directly on myMusic? You can actually complete this challenge using your method but you would need to do a few additional things. First, you would need to define an empty object for the second element in the myMusic array. Then you would need to add the property/values for that object to the second element of myMusic, not to myMusic itself.

An alternative would be to add the new music object directly to the myMusic array right below the first music object. In other words, modify the original myMusic array code by adding the new object directly below what is already there instead of creating a bunch of new lines of code to add each project/value separately.


Thank you. I found a way around this problem by declaring a variable and then pushing it into the array.

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