Record collection - what am missing? //this is my solution and since I am newbie, I don't know where I am going wrong. I get the results when I run the code in chrome console but I don't get a pass in test environment

function updateRecords(id, prop, value) {
   
if (prop === "artist" && value !== ""){
    return collection[id][prop] = value;
    
}else if (prop === "tracks" && value !== ""){
    
    if(collection[id].hasOwnProperty("tracks")){
    return collection[id][prop].push(value);
    }else{
        collection[id][prop] = [];
    return  collection[id][prop].push(value);
    }
    
}else if(prop === "album" && value !== ""){
    return collection[id][prop] = value;
}else if(value === "")
return    delete collection[id][prop];
}  
1 Like

Not sure if you figured out your issue, but you were not returning the entire collection object in your return statements.

2 Likes

Yes , did what you said and I got the pass. removed all returns and return the collection afterwards.Many thanks.

1 Like

great question, though. It’s the little things that tend to bite us, as developers.

2 Likes