Hi!
In this exercise ¿why isn’t this code the right answer? It gives me the next error:
After updateRecords(2548, “artist”, “”), artist should not be set
function updateRecords(id, prop, value) {
if (prop != “tracks” && value != “”) {
collection[id][prop] = value;
}
if (prop == “tracks” && (collection[id].hasOwnProperty(prop) == false)) {
collection[id].tracks = [];
if (value != “”){
collection[id].tracks.push(value);
}
}
if (prop == “tracks” && (collection[id].hasOwnProperty(prop) == true))
{
if (value == “”){
delete collection[id][prop]
} else {
collection[id].tracks.push(value);
}
}
return collection;
}