function updateRecords(id, prop, value) {
if (prop === "tracks" && value !== "") {
if(collection[id][prop]) {
collection[id][prop].push(value);
}
else {
collection[id][prop]=[value];
}
} else if (value !== "") {
collection[id][prop] = value;
} else {
delete collection[id][prop];
}
return collection;
}
Can you please shed some light on the difference between collection[id][prop] = [value] and collection[id][prop] = value ? The problem has haunted me for few days. Thank you loads!
The code above is from Basic Code Solution in guide section. Have a nice day!