Basic Javascript Record Collection test failing

Tell us what’s happening:

The challenge is not accepting my solution because one test is failing. But when I log that test to the console, the output is exactly what it is looking for (as far as I can tell).

When I log the following, it says the tracks property should not be set (failed test)
console.log(updateRecords(2548, “tracks”, “”));

but my output is: ‘2548’: { album: ‘Slippery When Wet’, artist: ‘Bon Jovi’ },

So I’m not seeing why this test fails. There is no tracks property in it. Any thoughts from anyone out there? I assume I’m making a dumb mistake somewhere, but for the life of me I cannot find it.

Your code so far

// Setup
var collection = {
2548: {
  album: "Slippery When Wet",
  artist: "Bon Jovi",
  tracks: [
    "Let It Rock",
    "You Give Love a Bad Name"
2468: {
  album: "1999",
  artist: "Prince",
  tracks: [
    "Little Red Corvette"
1245: {
  artist: "Robert Palmer",
  tracks: [ ]
5439: {
  album: "ABBA Gold"

// Only change code below this line
function updateRecords(id, prop, value) {
  if (prop != "tracks" && value != "") {
    collection[id][prop] = value;
  else if (prop === "tracks" && collection[id].hasOwnProperty("tracks") === false) {
    collection[id]["tracks"] = [];
  else if (prop === "tracks" && value != "") {
  else if (value === "") {
    delete collection[id][prop];

return collection;

// Alter values below to test your code

console.log(updateRecords(2548, "tracks", ""));
//console.log(updateRecords(2548, "artist", ""))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Record Collection

Link to the challenge:

Try resetting the challenge and putting your solution in again. It is passing all tests when I run your code.

1 Like

Thank you very much. That did fix it. I’ve reloaded the page many times just in case the back-end container expired (happens a lot on Codecademy), but I didn’t try resetting the whole thing. I’ll remember this for future reference.