Challenge Manipulating Complex Objects has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}, _**this coma is missing and it may really confuse people especially since they are being told to add the record below**_
// Add record here
{
"artist": "Michael W. Smith",
"title": "Worship",
"release_year": 2001,
"formats": [
"mp3",
"CD",
"Cassette"
]
}
];
@Ramanusasango There is only one element in the array by default, so I don't see why would there be a comma? Once you add another object as the second element, then you add the comma. Besides, there's also a note -
Note
You will need to place a comma after every object in the array, unless it is the last object in the array.
I had the same issue. I assumed that everything above the "// Add record here" could be left alone. I couldn't get it to take my solution until I saw that missing comma.
While in the JavaScript community some prefer to keep trailing commas after objects and properties, while others do not agree upon it. Also note that when you lint your code and you have a trailing comma in your code, the linter will throw a warning as: Expected an identifier ...
, unless you explicitly manage the linter properties file and make the trailing comma's check as false.
This confusion has been seen before in the past related to this challenge:
Campers often just see and add the code after the // Add record here
and overlook the NOTE in the instructions.
Unfortunately, this is something that can't be managed perfectly. We have deliberately left this, to make a reminder the instructions should be read carefully. Closing as done earlier in past.
Most helpful comment
I had the same issue. I assumed that everything above the "// Add record here" could be left alone. I couldn't get it to take my solution until I saw that missing comma.