"Prop" in Record Collection

Tell us what’s happening:
Hey there!
I am trying to solve the quest but I have an issue in understanding the “prop” variable. As I understand the user story, I have to create a variable named “prop” first with reference to the data “artist” and “tracks”. A container for the metadata so to speak. I took a glance on the solution because and it seems creating a variable named “props” is not necessary at all…I just do not get why. How does the code know, that I refer to “tracks” or “artist” when I use “prop” in switch or if/else-statement to create the given conditions? I just can’t wrap my head around it :smiley: Thanks for your help!

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:78.0) Gecko/20100101 Firefox/78.0

Challenge: Record Collection

Link to the challenge:

When you define functions, you can add any number of parameters you want.
The body of the function will be able to read and access the arguments that gets passed to it.

For example imagine a function like this:

function isEven(number) {
   return number % 2 === 0
}

The above is a function called isEven that accept a parameter, which in the context of the function is “called” number.

So when I invoke it, I can pass whichever value I want, and on each execution the argument will be different.

isEven(2) // true 
isEven(4) // true
isEven(7) // false

In the same way, in the exercise is defined a function called updateRecord that will accept 4 different parameters.

function updateRecords(object, id, prop, value)

According to the value passed the arguments will differ. Look at the test example on the left side of the page:

updateRecords(recordCollection, 5439, "tracks", "Take a Chance on Me")
updateRecords(recordCollection, 1245, "tracks", "Addicted to Love")
updateRecords(recordCollection, 5439, "artist", "ABBA")

Hope this helps :sparkles: