Don't understand Record Collection


I have currently spent some time trying to understand the record collection task in Basic JavaScript. I understand some of the general principles with if/else statements, but I don’t understand how to “update” the values.

I understand this is a partial solution to the problem

if (prop != “tracks” && value != “”){

collection[id][prop] = value;


I had no trouble with the first line, but how does the collection line “update” the records?

Thanks for any help.


If you have trouble understanding this, I would suggest you go back and review previous exercises.

It’s simply trying to access a some nested value inside collection object. The values inside of brackets are ‘keys’ and they are variables. So you can dynamically set them to retrieve a specific value of collection object. For example, if

let id=1;
let prop = "firstName";
let collection = {
  1: {
    firstName: "Abby" 

hen collection[id][prop] will return “Abby”.