Record Collection stuck

Tell us what’s happening:

Hey friends!

Well… I have been stuck a couple of hours in this problem. I have tried to express in coding the given instructions, but my code is not working.

Your code so far

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

// 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": [ 
        "Little Red Corvette" 
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    "5439": {
      "album": "ABBA Gold"
// 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) {
  return collection;

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


var myPlants = ["ficus", "oak", "maple"];

I get it!
Thank you!

Ok folks.

Finally, I reach the solution.

Merci également.