Record Collection programs

The code does not seem to work at all

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(object, id, prop, value) {
if(prop!=='tracks' && value!== ""){
}else if (prop==="traks" && !object[id].hasOwnProperty(tracks)){
}else if(prop==="tracks" && value!==""){
}else if (value===""){
  delete object[id][prop];

return object;

updateRecords(collection, 5439, 'artist', 'ABBA');

Your browser information:

User Agent is: Mozilla/5.0 (iPad; CPU OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1.

Challenge: Record Collection

Link to the challenge:

Can you please elaborate on the problem and what you trying is?

1 Like

Just eyeballing this I can see some obvious typos in variable and property names (obejct and traks). Not sure if that’s all that’s needed to get this working for you but it’s a start :slight_smile:


when using “if” the last one should be “else”
change it to this:

else  (value===""){
  delete object[id][prop];

instead of this:

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

that might be the problem :slightly_smiling_face:

1 Like

I think you are getting a “tracks is undefined” error from here

can you imagine why?

1 Like

I am sorry to disturb you all but I understood my mistakes thank you for helping.