Record collection Help I can't see what wrong with it

Tell us what’s happening:
When I submit it checks some of the testing part and other are not working and I don’t know why

Your code so far


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

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

console.log(updateRecords(collection, 5439, 'artist', 'ABBA'));

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13310.91.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.131 Safari/537.36.

Challenge: Record Collection

Link to the challenge:

I’m not sure why you change the function signature that was provided. This is causing your problem. You should use the provided function signature.

1 Like