Hello,
I’m struggling with the record collection challenge. Could someone please review my current code to see where I’m going wrong? It’s only the last 2 tests that aren’t passing. Many thanks
function updateRecords(id, prop, value) {
if(prop !== "tracks" && value !== "") {
collection[id][prop] = value;
}
else if(prop === "tracks" && collection.hasOwnProperty(prop) === false) {
collection[id].tracks = [];
collection[id][prop].push(value);
}
else if(prop === "tracks" && value !== "") {
collection[id][prop].push(value);
}
else if(value === "") {
delete collection[id][prop];
}
return collection;
}