Basic JavaScript - Record Collection

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

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 (iPhone; CPU iPhone OS 16_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Mobile/15E148 Safari/604.1

Challenge: Basic JavaScript - Record Collection

Link to the challenge:

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

In the challenge I am confused…I don’t know where to start from: using “if /else “ statement or the “switch “?the fact the function takes many arguments is bit confusing…where do I start?

I would start by understanding what each argument means.

Which ones do you need help understanding?

Arguments: records , Id, prop, &value…what are their specific roles in this challenge …which one comes first when writing the function ?

The updateRecords function takes 4 arguments represented by the following function parameters:

  • records - an object containing several individual albums
  • id - a number representing a specific album in the records object
  • prop - a string representing the name of the album’s property to update
  • value - a string containing the information used to update the album’s property

The arguments are described here. Can you be more specific about what parts of this description you need explained?

The arguments are given to the function in the order shown in the function signature

function updateRecords(records, id, prop, value)