Record Collection ,Basic JavaScript

Tell us what’s happening:
Am not understanding how to add the if…else statement.

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) {
return object;
}
updateRecords(collection, 5439, 'artist', 'ABBA');



updateRecords(collection, 5439, 'artist', 'ABBA');
if(updateRecords(collection, 5439, 'artist', 'ABBA')){
updateRecords[2] = updateRecords[3]
}else if(updateRecords(collection, 5439, "tracks", "Take a Chance on Me")){
updateRecords[2] = updateRecords[3]
}else if(updateRecords(collection, 2548, "artist", "")){
updateRecords[2] = updateRecords[3]
}else if(updateRecords(collection, 1245, "tracks", "Addicted to Love")){
updateRecords[2] = updateRecorde[3]
}else if(updateRecords(collection, 2548, "tracks", "")){
updateRecords[2] = updateRecords[3]
}else if(updateRecords(collection, 1245, "albumTitle", "Riptide")){
updateRecords[2] = updateRecords[3]
}

Your browser information:

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

Challenge: Record Collection

Link to the challenge:

an if-else statement is written as

if (condition) {
   // if condition is true this execute
} else if (condition2) {
  // if condition2 is true this execute
} else {
  // if none of the above conditions are true this execute
}

What have you tried so far? We’re happy to help you debug your code, but we need to see it first.

Hi @19alema, I realise there was a duplicate post: I’ve edited your post here to include the code from the duplicate.

The code is not correct in a number of significant ways, and it seems to exhibit a misunderstanding of some of the basics of JS.

Can you explain how you think your code works/should work? It may be easier to explain how you’ve got this wrong if we can understand your thinking here.