Hello dear community your help would be of great help to me I am a beginner I do not understand this exercise

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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36

Challenge: Record Collection

Link to the challenge:

Do you not understand what is required of you or do you understand what is required but don’t know how to start?

The two
Thank you for answering

So, you don’t understand anything about this?

Ok, let’s start at the beginning and take this one step at a time. The first sentence in the description is:

You are given an object literal representing a part of your musical album collection.

What part of that do you not understand?

It’s referring to this:

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'
  }
};

Do you understand what that is? In terms of JS and in terms of functionality?

ok thanks for the answer
can you explain the folds to me in detail

I’m sorry, I’m not sure what “the folds” means.

Specific questions tend to get better answers in quality and quantity. Can you ask a specific questions and explain exactly what you don’t understand? It’s OK if you need ask more afterwards, but the “explain everything to me” approach is not going to work well, I think.

So, please quote a sentence from the problem description and explain what about it you are not understanding. We can start there.

1 Like

I think that you are referring to { and } as folds? They are often referred to as curly braces or brackets in code. Sometimes you will see [ square braces ] as well.

Curly braces represent {objects}.
Square braces represent [arrays].

This exercise asks us to create a function called updateRecords()
This function takes in the arguments of (records,id,prop,value)
You can assume it will always receive the object recordCollection as records.

It should check if the argument of prop is tracks.
If it is, then it should check if the argument of value has a tracks property.
If it does not, then it should create one as an array with value inside.
If the argument prop is tracks and the argument value is not an empty string, then add value to the end of the existing album’s array.
If the argument value is an empty string, delete the given prop property from the album.

It should always return the entire record collection after these changes are made.

Hope this helps clarify!

1 Like

Thank you so much
I think this message can help me

Ok thank you very much I will try to be clearer on my messages