Tell us what’s happening:
Describe your issue in detail here.
After
updateRecords(recordCollection, 1245, “tracks”, “Addicted to Love”)
tracks
should have the stringAddicted to Love
as the last element.
Your code so far
function updateRecords(records, id, prop, value) {
if (prop != 'tracks' && value!=""){
records[id][prop] = value;
}
else if(prop === 'tracks' && records[id].hasOwnProperty('tracks')===false ){
records[id][prop] = [value];
}
else if(prop === 'tracks' && value !==""){
records[id][prop].push[value];
}
else if(value == ""){
delete(records[id][prop]);
}
return records;
}
**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36
Challenge: Record Collection
Link to the challenge: