U are missing one argument and that arguments should be used in your code not var collection
like u need to make paramenter in function to define collection as object like which object this function is taking as parameter.
Hope so u understood
oh noooooo i just saw this console.log will be at end i just gave example how u wil u write prameters and will put its value dosent mean that u will write values just after defining prameters
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));
// Only change code below this line
function updateRecords(object,id, prop, value) {
console.log(updateRecords(collection,5439,"artist","ABBA"));
if (value === "")
{
delete collection[id][prop];
}
else if (prop === "tracks") {
collection[id][prop] = collection[id][prop] || [];
collection[id][prop].push(value);
} else {
collection[id][prop] = value;
}
return collection;
}
//Alter values below to test your code
updateRecords(2468, "tracks", "test");
this what i was talking about that use pramaeter u passed in function in code not collection just like this example replace collection with parameter u passed
You didn’t fill out Tell, us what’s happening or describe your issue, which is why I asked.
It looks like you copied an old solution (possibly from the video?) and changed the function signature. You should not reference the global variable collection at all in your code.
Yes I tried to understand what I was doing wrong and correct. I still can not find the correct solution. I watched the tutorials and forums but I still can`t find.
everywhere in your function where you have collection, you should not. You need to use the object passed in as an argument in the original function signature.
i was just giving u example how to use after passing parameter object in function ,not to changing its position u define its parameter outside function not within curly braces of function.