Basic JavaScript - Record Collection

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

So like many of you, I have spent a long time trying to understand this. I have had to look at the answers to “guess” that [id] which is only defined and mentioned in the function below the setup and no place else, is supposed to equal the numbers in the album records (2548, 2468 and so on). I am also guessing that the ‘id’ parameter is built into Javascript, and yet I cannot find any information online about this.

In all the explanations so far, it is just assumed that everyone understands where [id] comes from, and through guesswork I am somehow supposed to not stumble onto a wrong answer that seems right. Anyone else feel like this?

  **Your code so far**
// Setup
const 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/103.0.5060.53 Safari/537.36

Challenge: Basic JavaScript - Record Collection

Link to the challenge:

The instructions say that id is a function argument

You start with an updateRecords function that takes an object literal, records, containing the musical album collection, an id, a prop (like artist or tracks), and a value.

Understanding what the function arguments all mean is a huge first step in this challenge.

No. id is not some special keyword… It is just a function argument.

The specific values of the function arguments are set when the function is called.

2 Likes

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