Please help in advancedAlgorithm.recordCollection the code is correct but the test is unpassable by 1 test

// 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": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {

  if(prop == "tracks" && collection[id][prop] === undefined){
     collection[id][prop] = [];
     collection[id][prop].push(value);
     return collection;
    
  }else if(prop == "tracks" && collection[id][prop].length > 0){
    if(value.length === 0){
     delete collection[id][prop];
     return collection;
    }
    collection[id][prop].push(value);
    return collection;
    
  }else if(collection[id][prop]){
    collection[id][prop] = value;
    
        if(collection[id][prop].length === 0){
          delete collection[id][prop]; 
        }
    return collection;
    
  }else if(collection[id][prop] === undefined){
    collection[id][prop] = value;
    return collection;
  }
  
}

// Alter values below to test your code
updateRecords(2548, "tracks", "Addicted to Love");

all the tests pass except for the

After updateRecords(1245, “tracks”, “Addicted to Love”), tracks should have “Addicted to Love” as the last element.

tracks is an object/ array and the elements inside are strings and it is the last element. I am return collection right after so theres no overlapping with other code… I have no idea why its not passing the test. Please help! Thanks!

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

Take a look at the output for updateRecords(1245, 'tracks', 'Addicted to Love'). The tracks property should be an array, not a string.