Hey there. I’m working on the Build a Record Collection lab and I can get every test to pass except for test 3. It only returns one track like the prompt asks, so i’m not sure what’s wrong here. Can anybody help?
Here is my code:
function updateRecords(records, id, prop, value) {
if (value == "") {
delete records[id][prop];
console.log(records[id]);
return records;
}
else if (prop == "tracks" && value !== "" && records[id].hasOwnProperty("tracks") == false) {
records[id][prop] = value;
console.log(records[id])
return records;
}
else if (prop == "tracks" && value !== "") {
records[id][prop].push(value);
console.log(records[id])
return records;
}
else {
records[id][prop] = value;
console.log(records);
return records;
}
}
and here is the output I get:
{ albumTitle: 'ABBA Gold', tracks: 'Take a Chance on Me' }
sorry for all the console.logs! Because the freecodecamp editor doesn’t always tell me answers, I compile it in an outside editor that tells me the errors and outputs more reliably