Someone can tell why it doesn’t work though it works in Visual Studio Code?
function updateRecords(records, id, prop, value) {
if(recordCollection[id].hasOwnProperty([prop])==true){
if(value != "" && prop != "tracks"){
recordCollection[id][prop] = value;
}
else if(value == ""){
delete recordCollection[id][prop];
}
else if(value != "" && prop == "tracks"){
recordCollection[id][prop].push(value);
}
}
if(recordCollection[id].hasOwnProperty([prop])==false){
if(prop == "tracks" && value == ""){
recordCollection[id].tracks = [];
}
else if(prop == "tracks"){
recordCollection[id].tracks = [value];
}
else{ recordCollection[id][prop] = value; }
}
return records;
}