I have been working on this for two days and still cant figure it out. What am I missing? Here is my code:
function updateRecords(object, id, prop, value) {
if(collection[id].hasOwnProperty(prop)){
if(value === ""){
delete collection[id][prop];
}
else if(prop == "tracks"){
collection[id][prop].push(value);
}
else{
collection[id][prop] = value;
}
}
else {
if(value != ""){
if(prop == "tracks"){
collection[id][prop] = [value];
}
else{
collection[id][prop] = value;
}
}
}
return collection;
}