Cant understand what to do here

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

// Setup
var recordCollection = {
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(records, id, prop, value) {
return records;
}

updateRecords(recordCollection, 5439, 'artist', 'ABBA');
  **Your browser information:**

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

Challenge: Record Collection

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

The challenge would like you to complete the function such that if a user passes in a javascript object with records, a record id to update, a property and a value then the object would be updated and returned. Where you see it says “Only change code below this line” just add the code necessary in your function definition so that the function works as specified.

If you read the prompt it may give you more information like not taking record ids that don’t exist.

Possible solution:

Mod edit: solution redacted

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

HI @dbbhavishya !

Welcome to the forum!

This challenge trips up a lot of people.

The key to solving it, is to slowly break down each of the rules provided for you in the lesson and translate it into code.

Start with the first one.

  • If prop isn’t tracks and value isn’t an empty string, update or set that album’s prop to value .

Take the first half of that sentence and slowly translate that into code, then take the second half of that sentence and translate it into code.

If you get stuck on how to translate that first rule into code, then reply back with your code attempt and we can assist you from there.

Once you figure out the first rule, then move onto the second, third and fourth one.

Hope that helps!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.