Manipulating Complex Objects Syntax

Manipulating Complex Objects Syntax
0.0 0

#1

Tell us what’s happening:

Your code so far

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



myMusic.push({artist:"Glen Campbell", title: "Galveston", release_year: 1969, formats: ["CS","8T","LP"], gold: true});


Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MS-RTC EA 2; rv:11.0) like Gecko.

Link to the challenge:


#2

It’s expecting you to manually add the other object to the array, not use push - what you’ve done would work in practise, but the answer is simpler than that


#3

#4

You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.

We have set your post to unlisted. Thanks for your understanding.


#5

I think this is a genuine query - afaics the code is wrong, and won’t work. I was a bit confused, but looking at the challenge, the posted code will error because it’s literally just asking for a second object to be typed out into the array.