Record Collection-link didnt work in the previous post

Hi, @karansingh1172 said my previous post is not showing, so I posted it again.
The problem here is that I do not know how to create an array in this situation. Also, I cannot see what else prevents me from passing the test other than that.
Would be great if someone can help me with this, thanks!
Your code so far

// 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) {
/*if the value is not empty */
  /*if the prop is tracks*/
  if (prop==="tracks"){
    /*if the albums have a "tracks" property */
    }/*if it doesn't have a "tracks" property*/else {
/*create an new array here */
    /*if the prop is not "tracks" and the value is not empty*/
  }else {
/*if the value is empty*/
}else {
  delete collection[id][prop];
  return collection;

// Alter values below to test your code
updateRecords(2548, "artist", "Bon Jovi");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:

You can create an array in the usual way
variable = [], it can be empty like this, or it can have a value inside (so you don’t need push())

1 Like