Basic JavaScript - Record Collection

Hi all!
I’m a newbie here as well. I’m not sure how to go about using the push method to fulfill the 2nd requirement:
• If prop is tracks but the album doesn’t have a tracks property, create an empty array and add value to it.

My code so far:

function updateRecords(records, id, prop, value) {
  if (prop != "tracks" && value != "") {
    records[id][prop] = value;
  } else (prop == "tracks" && records[id].hasOwnProperty("tracks") == false) {;

I moved your post into its own thread.

You have a couple of issues here:

You cannot use dot notation when you have an object property name stored in a variable

Also, you do not want to push to the record, but to the "tracks" property of the record

And prop is a string instead of an object, so it will not have a value property