Record Collection tracks Take a Chance on Me

Hey Guys i having problem with this challenge.

I don’t understand why he keeps telling me that that part doesn’t work. If I am putting a yes where I push the parameter value when prop === “tracks” I asked for help before but it is not clear. sorry for not be good.

After updateRecords(5439, "tracks", "Take a Chance on Me") , tracks should have "Take a Chance on Me" as the last element.

function updateRecords(id, prop, value) {

if(prop !== "tracks" && value !== "" ){

    collection[id][prop]=value;

}

if(prop === "tracks" && value !==""){

  

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

}

if(prop === "tracks" && collection.hasOwnProperty("tracks")){

 collection[id][prop]=[];

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

}

if(value === ""){

  delete collection[id][prop];

}

  return collection;

}

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

This

happens before this

1 Like

i got it Thank you!.

Congratulations! Happy coding.

can either of you help me understand why one comes before the other?

This is a very old topic. Please create a new topic with the code you have for this challenge.


If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.