I was writing some verbose explanations, but I see you have your own theories, which are not so bad. Why don’t you try it?
Then if it won’t work, ask more questions)
I thought the dot and bracket notations did the same thing.
Phew!
my code so far btw…
if (prop != “tracks” && value == “”){
records[id][“prop”] = value
if (prop == “tracks” && records[id][“tracks”] == undefined){
records[id][“tracks”][“”] = value
function updateRecords(records, id, prop, value) {
//If prop isn't tracks and value isn't an empty string, update or set that album's prop to value.
if (prop != "tracks" && value == ""){
records[id][prop] = value;
}
//If prop is tracks but the album doesn't have a tracks property, create an empty array and add value to it.
else if (prop == "tracks" && records[id]["tracks"] == undefined){
records[id][prop][""] = value;
}
//If prop is tracks and value isn't an empty string, add value to the end of the album's existing tracks array.
else if (prop == "tracks" && value != ""){
records[id][prop].push(value);
}
// If value is an empty string, delete the given prop property from the album.
else if(value = ""){
delete records[id].prop
}