I’ve completed the Record Collection challenge. I want to be sure that the code corresponds to the instructions. I’ve commented the instructions at the end of what I believe to be the corresponding code. I just want to make sure that I interpreted the instructions correctly. Thanks
function updateRecords(id, prop, value) {
if (value === "") {
delete collection[id][prop];//If value is empty (""), delete the given prop property from the album
} else if (prop === "tracks" && value !== "") {
collection[id][prop] = collection[id][prop] || [];//If prop is "tracks" but the album doesn't have a "tracks" property, create an empty array before adding the new value to the album's corresponding property
collection[id][prop].push(value);//If prop is "tracks" and value isn't empty (""), push the value onto the end of the album's existing tracks array
} else {
collection[id][prop] = value;//If prop isn't "tracks" and value isn't empty (""), update or set the value for that record album's property
}
return collection;//Your function must always return the entire collection object
}