Does anyone know my mistake?

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"]
  }  // Add record here
];

Does anyone know why this isn´t working?

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

Remeber that when you are writing an array, you must separate its elements with commas.

Aren´t they seperated with commas?

Your array contains two items, but there is no comma between them.

Please could you tell me the line, I don´t get it.

What are the items in your array?

You are trying to put two objects in the array. Each object’s properties are correctly separated by commas. However, the actual objects are not.

The items in my arry are CD,8T and LP

I’m talking about the array myMusic.

You have an array of objects that contain arrays!

myMusic is an array!

You have an array with two objects in it. But the two objects are not separated by a comma as needed.

Basic JavaScript: Manipulating Complex Objects

Note
You will need to place a comma after every object in the array, unless it is the last object in the array.

You have:

const array = [
  {
    ...code
  }
  {
    ...code
  }
]

Should be:

const array = [
  {
    ...code
  },
  {
    ...code
  }
]
1 Like