Bug in "Manipulating Complex Objects"? (Help me understand)

I also struggled with the comma, errors was asking for a semicolon didn’t help!

1 Like

so this comma made all the differences. now I see. thanks a lot.

2 Likes

This stuff is getting really difficult. Half the time I end up cheating by googling it. The HTML was so much easier. This stuff doesn’t flow as I’d hoped it would.

2 Likes

Thanks for your explanation, I was having some problem with this challenge.

2 Likes

@P1xt

Thanks for the help with that comma!

2 Likes

Hi all, I do not think its meant to me manual guys… as a manual input would require to change the semicolon for a comma…
Instead, if you just “push()” it then no change is necessary.

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

myMusic.push(
{
“artist”: “Joaquin Perez”,
“title”: “Indiana”,
“release_year”: 1978,
“formats”: [
“CD”,
“8M”,
“LP” ],
“gold”: false
}
);

console.log(myMusic[0]);

1 Like

I was stuck on this as well.
The comma between the strings is what messed me up. Thanks for the clarification!

Doesn’t improve the outcome at all. I’ve switched it several times, and …

X myMusic should have at least two elements
X myMusic[1] should be an object
X myMusic[1] should have at least 4 properties
X myMusic[1] should contain an artist property which is a string
X myMusic[1] should contain a title property which is a string
X myMusic[1] should contain a release_year property which is a number
X myMusic[1] should contain a formats property which is an array
X formats should be an array of strings with at least two elements

// Add record here
var myMusic = [
{
“artist”: “Pharrell”,
“title”: “Happy”,
“release_year”: 2015,
“formats”: [
“mp3”,
“cd”
“tape”
]
}
];

I am already bold…so it wouldn’t have made a difference :stuck_out_tongue_closed_eyes:

wow!
that was my mistake too. Thanks

I was searching for 15 min why my code wasn’t working, decided to look up…
forgot a “,” between the objects. Now I feel kinda dumb!

THANK YOU ALL!!! Comma missing equalled epic fail and lots of nightmare!

Didn’t help that when I clicked “Get a Hint” it took me to a “Doesn’t Exist” page. So a double-bug situation.

Thanks everyone. I was stuck on this one for quite a while too! :smiley:

This one was driving me bananas too! I think it was more syntax than anything else! Those commas are going to get the best of me :smiley: - after some time, I finally did come up with a good solution!

var myMusic = [
{
“artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [
“CS”,
“8T”,
“LP” ],
“gold”: true
}, <— this is what had me stuck for a while!
{
“artist”: “The Rolling Stones”,
“title”: “It’s just Rock 'n Roll”,
“release_year”: 1974,
“formats”: [
“CS”,
“8T”,
“LP”],
“gold”: true
}
];

I think, like me, most folk take the note about commas to refer to the pairs within the object. As opposed to between multiple objects in the array.

In my case, when using Sublime and you add things into the settings file, it doesn’t like the last property to have a comma on the end.

shakes fist Damn you Sublime Text. Damn you all to hell.

Thank you thank you thank you for this post. Spent the better part of an hour trying to debug this one! Seeing as how the earliest posts on this go back to June of 2016 it’s curious why the issue hasn’t been addressed in the lesson yet - unless the intention was to drive folks to reach out to their fellow campers, of course :slight_smile:

at first i thought that we should add a new [ ] beside the existing one, but then figured it out by only keep the { } brackets.

I figured it out I didn’t want to use Push as i didn’t see that as being what they were asking for. here is the Solution

var myMusic = [
{
“artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [
“CS”,
“8T”,
“LP” ],
“gold”: true,
},{
“artist”: “Incubus”,
“title”: “Science”,
“release_year”: 1990,
“formats”: [
“CD”,
“Cassette Tape”,
“LP”],
“Platinum”: true
}

// Add record here
];

Ha didn’t scroll all the way threw but I’m glad I was able to figure out on my own anyway!

You must put comma at the end of the example.

2 Likes