Record collection console mirror

Hi, I’m still having trouble with the FCC console mirror returning parts of the object even when I delete all return statments.
I’m having this trouble with both FireFox and Chrome.

Could you give an example of your problem, and also post your code?

Hi, sorry I didn’t reply sooner but have just got back to my desktop.

The problem I have is once I clicked the run test button the FCC console mirror returns the whole object with this code…

var collection = {
“2548”: {
“album”: “Slippery When Wet”,
“artist”: “Bon Jovi”,
“tracks”: [
“Let It Rock”,
“You Give Love a Bad Name”
“2468”: {
“album”: “1999”,
“artist”: “Prince”,
“tracks”: [
“Little Red Corvette”
“1245”: {
“artist”: “Robert Palmer”,
“tracks”: [ ]
“5439”: {
“album”: “ABBA Gold”

//Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

//Only change code below this line
function updateRecords(id, prop, value) {

return collection[id];

// Alter values below to test your code
updateRecords(5439, “artist”, “ABBA”);

this happens in FireFox and Google

As you can see my return statement is return collection[id]; and I’m expecting the following returned
"5439": {
“album”: “ABBA Gold”
not the complete collection.
Thanks for having a look

1 Like

The instructions say you should always return the entire collection back. You must use:

  return collection;

You still have a lot of work to do to pass the challenge though. Currently, your function just returns the object related to a specific id.

Hi, thanks for taking a look.

The Record Collection challenge in my map is marked as complete as it must have been moved from a previous section but I thought I would have another go.

When I started writing the code I was having strange results returned so I wrote the most basic ///return collection[id] ; inside the function ///updateRecords(5439, “artist”, “ABBA”);

Although I knew the challenge would be marked wrong I was expecting
"5439": {
“album”: “ABBA Gold”
to be returned but instead the whole object is returned.

As I said earlier this challenge is marked as complete for me so its no real issue but strange all the same.

1 Like

yep. it returns the whole object no matter. i guess that’s how they set it up. i was also experimenting with different return statements, return emtpy string, return one object…still got the whole object back…

Thanks for having a look. I thought I was going mad, I’m just pleased I’ve already passed that challenge.