Record Collection **

For the Solution, I recommend either #3, #2 or #1 (in the Comments Area.)

Feel free to share your solutions in the Comments area too. (Sandra Marie had a very unique solution.)
** … scroll all the way down for an update: (July 15, 2016)

My original Solution:

// Setup
  var collection = {
      2548: {
        album: "Slippery When Wet",
        artist: "Bon Jovi",
        tracks: [ 
          "Let It Rock", 
          "You Give Love a Bad Name" 
        ]
      },
      2468: {
        album: "1999",
        artist: "Prince",
        tracks: [ 
          "1999", 
          "Little Red Corvette" 
        ]
      },
      1245: {
        artist: "Robert Palmer",
        tracks: [ ]
      },
      5439: {
        album: "ABBA Gold",
        "tracks": ["Take a Chance on Me"]
      }
  };

// Keep a copy of the collection for tests    
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line    
function updateRecords(id, prop, value) {
  if (value !== "" && prop == "tracks") {
      collection[id].tracks.push(value);           
  } else if (value !=="") { 
      collection[id][prop] = value;    
  } else if (value ==="") { 
      delete collection[id][prop];    
  }  
  return collection;
}

// Alter values below to test your code    
updateRecords(5439, "artist", "ABBA");

Someone shared this with me:

function updateRecords(id, prop, value) {

  var newID = id;
  var newProp = prop;
  var newValue = value;

  if ([collection].hasOwnProperty(newID)){

      if(newID !== "" ){

          if(newProp !== "tracks") {

            [collection][newID][newProp] = newValue;

          } else if (newValue !== "") { 


          }   


      }


  }

  return collection;

} 

updateRecords(5439, "artist", "ABBA");

Solution #2

function updateRecords(id, prop, value) {

// Only change code below this line function updateRecords(id, prop, value) {
// If value is non-blank (value !== "") and 
// prop is not "tracks" 
// then update or set the value for the prop.

  if (value !== "" && prop !== "tracks") {
    collection[id][prop] = value;
  }

// If the prop is "tracks" and value is non-blank, 
// push the value onto the end of the tracks array.

  else if (prop === "tracks" && value !== "") {
    collection[id][prop].push(value);
  }

// If value is blank, 
// delete that prop.

  else if (value === "") {
    delete collection[id][prop];
  }

// Always return the entire collection object.

return collection;

}

// Alter values below to test your code

updateRecords(5439, "artist", "ABBA");

Solution #3

The function could also be written like this:
function updateRecords(id, prop, value) {
  if (value !== '') {
      if (prop === 'tracks') {
        collection[id][prop].push(value);
      } else {
        collection[id][prop] = value;
      }
  } else {
    delete collection[id][prop];
  }
  return collection;
}  

My Improved Solution #2

function updateRecords(id, prop, value) {
  if (value!==""&&prop=="tracks"){
      collection[id][prop].push(value);           
  } else if(value!==""){ 
      collection[id][prop] = value;    
  } else { 
      delete collection[id][prop];    
  }  
  return collection;
}

Challenge Source: Free Code Camp’s Record Collection

Related Pens:

Their Solution Template #1
My Solution Template #1 (redacted)

Special Thanks to Joseph @revisualize for his code and contributions!

** Update: July 15, 2016

// Setup
var collection = {
  2548: {
    album: "Slippery When Wet",
    artist: "Bon Jovi",
    tracks: [ 
      "Let It Rock", 
      "You Give Love a Bad Name" 
    ]
  },
  2468: {
    album: "1999",
    artist: "Prince",
    tracks: [ 
      "1999", 
      "Little Red Corvette" 
    ]
  },
  1245: {
    artist: "Robert Palmer",
    tracks: [ ]
  },
  5439: {
    album: "ABBA Gold", 
    tracks: ["Take a Chance on Me"]
  }
};

// Keep a copy of the collection for tests

var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line

function updateRecords(id, prop, value) {
  if (value !=="" && prop == "tracks") {
      collection[id][prop].push(value);           
  } else if (value!=="") { 
      collection[id][prop] = value;    
  } else { 
      delete collection[id][prop];    
  }  
  return collection;
}

// Alter values below to test your code

updateRecords(5439, "artist", "ABBA");

I’ve seen some people condensing the solutions even more so here is my Improved Solution #3

function updateRecords(id, prop, value) {
  if (value!==""&&prop=="tracks")
    collection[id][prop].push(value);           
  else if(value!=="") 
    collection[id][prop] = value;    
  else delete collection[id][prop];    
return collection;
}

You can stop reading here if you don’t need to know the details about this issue.

… read on, if you are following the issue in our discussion thread )

You would come across mav1283’s comment (from June 6), when he said, “It worked now, someone from gitter suggest this:

  collection[id][[prop] = [value];

I did test it out and (as of today, July 15, 2016), this is what happens if we use his solution (minus the extra “[” which is most likely a typo):

@mav1283's Record Collection Solution

That said, I did review jminchew97’s solution and it does work, here is what he did:

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

    collection[id][prop] = [];
    collection[id][prop].push(value);

  } else if (prop == "tracks" && value !== "") {
    collection[id][prop].push(value);
  } else {
    delete collection[id][prop];
  }

  return collection;
}

And here is the output according to FCC’s internal CodeMirror-code:

collection = 
{
  "1245": {
    "artist": "Robert Palmer",
    "tracks": []
  },
  "2468": {
  "album": "1999",
  "artist": "Prince",
  "tracks": [
    "1999",
    "Little Red Corvette"
  ]
},
"2548": {
  "album": "Slippery When Wet",
  "artist": "Bon Jovi",
  "tracks": [
    "Let It Rock",
    "You Give Love a Bad Name"
    ]
},
  "5439": {
    "album": "ABBA Gold",
    "artist": "ABBA"
  }
}