Basic JavaScript - Record Collection clarification

Hello, this was very difficult to say the least , had to see the solution in order to get it correct,
however i was on the right track and this is where my question comes from.

i was using the id as reference via id[prop] because given this code

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'

i did not see the record handle anywhere .

i am thinking that records here is synonymous to the name of the objects const recordcollection.
if so, am i right to assume that a parameter of a function can be named anything and once the name of an object is referenced inside , they type of data structure is fetched by javascript itself?

i hope this question isnt badly made, thank you.

please post a link to the challenge for our reference so we can see it with you.

As I recall, there was a function call that provided this object as an argument to the function.
So inside the function, you were supposed to use the parameter given to you (I recall it was called records)

Yes, function parameters can be named anything.

function add(a, b) {
  return a + b;
function add(x, y) {
  return x + y;
function add(num1, num2) {
  return num1 + num2;

All three of these functions can be called exactly the same way.

add(40, 2);

You can pass variables as well (again, it doesn’t matter what the function parameter names are).

const bigNumber = 2002349;
const littleNumber = 1;
add(bigNumber, littleNumber);

In the case of record collection, there is a global variable named recordCollection, and a function updateRecords whose first parameter is named records. In the example function call they pass recordCollection as the first argument to updateRecords.

and you must always reference whats in the parameter rather than the source that is passed in , otherwise it wouldn’t work for anything that is passed in, thank you i understand now .

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