Record-Collection

I don’t understand why am I getting error in my code, please check the below image:
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;
}

Well, now I am able to find where I was missing the shot. :sweat_smile:, an extra closing bracket was needed at the end of first “if statement”.

1 Like