The third test is failing even though when I run it in the FCC editor it does what it says, as far as I can tell.
I know when it checks for the tests it uses some kind of strict checker but I’m not exactly sure how it works there.
Here is the third test:
3. After updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me"), tracks should have the string Take a Chance on Me as the last and only element.
Here is the project link:
const recordCollection = {
2548: {
albumTitle: 'Slippery When Wet',
artist: 'Bon Jovi',
tracks: ['Let It Rock', 'You Give Love a Bad Name']
},
2468: {
albumTitle: '1999',
artist: 'Prince',
tracks: ['1999', 'Little Red Corvette']
},
1245: {
artist: 'Robert Palmer',
tracks: []
},
5439: {
albumTitle: 'ABBA Gold'
}
};
function updateRecords(records, id, prop, value = "") {
if (value == "") {
console.log("Attempting deletion.");
delete records[id][prop];
return records;
} else if (prop != "tracks" && value != "") {
console.log(`Attempting to reassign the property of ${prop} to ${value}.`);
records[id][prop] = value;
return records;
} else if (prop == "tracks" && value != "" && !records[id][prop]) {
console.log("Attempting to create new tracks.");
records[id][prop] = value;
return records;
} else if (prop == "tracks" && value != "") {
console.log("Attempting to add new track.");
records[id][prop].push(value);
return records;
}
}