Manipulating Complex Objects Is this not asking for 2 arrays?

Manipulating Complex Objects Is this not asking for 2 arrays?
0.0 0

#1

Tell us what’s happening:

I was trying to create a 2 array which seems to be what it is asking I.e array [0] array[1] but seems to pass with just the one array am I misunderstanding what it is asking. Just wanted to check if this a bug or if I’m totally understanding the question wrong

these are the questions so you dont have to click the link
myMusic should be an array
myMusic should have at least two elements //does this mean 2 myMusics? myMusic[0], myMusic[1]?
myMusic[1] should be an object
myMusic[1] should have at least 4 properties
myMusic[1] should contain an artist property which is a string
myMusic[1] should contain a title property which is a string
myMusic[1] should contain a release_year property which is a number
myMusic[1] should contain a formats property which is an array
formats should be an array of strings with at least two elements
Your code so far


var myMusic = [0,
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CD",
      "8T",
      "LP"
    ],
    "gold": true
  }
  // Add record here
  
 ];

Your browser information:

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

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


#2

Insted of creating another element on your array with the value of 0, you should create an object with the following properties:

artist -> String
title -> String
release_year -> number
formats -> Array


#3

Ok so it is asking for another but the test seems to pass super easy on this question and just want to make sure I’m understanding it right would something along the lines of this be more appropriate for this question
var myMusic = [
{
“artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [
“CD”,
“8T”,
“LP”
],
“gold”: true
}
// Add record here did not change values but doesn’t matter
];
var myMusic = [1,
{
“artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [
“CD”,
“8T”,
“LP”
],
“gold”: true
}
];


#4

Almost, you don’t have to declare another variable, just add another element to the array.

var myMusic = [
{
    “artist”: “Billy Joel”,
    “title”: “Piano Man”,
    “release_year”: 1973,
    “formats”: [
        “CD”,
        “8T”,
        “LP”
    ],
    “gold”: true
},
 {
    “artist”: “The Killers”,
    “title”: “All these things that i've done”,
    “release_year”: 2004,
    “formats”: [
        “CD”,
        “8T”,
        “LP”
    ],
    “gold”: true
}
];

#5

Afther you’ve added the other element to the array, your array will have 2 elements:
Piano Man by Billy Joel and All These Things That I've Done by The Killers.

You can access those elements with myMusic[0] and myMusic[1] respectively, there’s no need to create an element with the number as you were doing.


#6

Oh Ok I see now. I figured I was doing something wrong but the darn test kept passing and saying I was correct.
Appreciate the help mate enjoy your day!