Help me i cant figure this out

Help me i cant figure this out
0

#1

im stuck on this challege


// Setup
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”: [
“1999”,
“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) {

collection.push(
{[id[prop[value]]]}
);
return collection;
}

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


#2

“collection” is an object not an array so push method won’t work. “id” is a property within “collection” and “prop” is a property within an “id”. “value” is data you should insert somewhere in the object depending on the situation.

Small example of an object:

// an object    property value property value
    var cat = { "name": "Tom", "owner": "John" };

    // output sample 1
    console.log(cat["name"]); // outputs "Tom"
    console.log(cat["owner"]); // outputs "John"
    
    // output sample 2
    console.log(cat.name); // outputs "Tom"
    console.log(cat.owner); // outputs "John"

    // output sample 3 - similar to what you'll be using
    var variable1 = "name";
    var variable2 = "owner";
    console.log(cat[variable1]); // outputs "Tom"
    console.log(cat[variable2]); // outputs "John"

You can find more information about objects at:
http://www.w3schools.com/js/js_objects.asp
http://www.w3schools.com/js/js_object_definition.asp

Hint

collection[id][prop] // place to assign to
value // variable to assign