Hi there, I am currently doing Record collection in Basic Javascript and have a question.
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;
}
In this code, what is different between
collection[id][prop].push(value); and collection[id][prop] = value;
?