I don’t understand why am I getting error in my code, please check the below image:
It is showing me the syntax error in spite of putting proper braces.
Someone please help me with this, what can I do to remove the error.
Here is my code:
function updateRecords(object, id, prop, value) {
if (prop === "tracks" && (!(collection[id].tracks))
{
collection[id].tracks = [];
}
if (prop === "tracks" && value !== " ")
{
collection[id].tracks.push(value);
}
else if (prop !== "tracks" && value !== " ")
{
collection[id].prop = value;
}
else if (value === " ")
{
delete collection[id].prop;
}
return object;
}