Basic JavaScript: Record Collection wording question

" If prop isn’t "tracks" and value isn’t empty ( "" ), update or set the value for that record album’s property."

I have a question for this section. Is this asking, if the properties and values in an album are present then modify the collection to include them?

Just wanted to know for clarification.

Thanks,

Ed

1 Like

post the challenge link to help campers undertand more your question .

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/record-collection

var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  
  
  return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

Hello Guys,
So in this challenge, in the description, there is a line that says “If prop isn’t “tracks” and value isn’t empty (”"), update or set the value for that record album’s property." Is it safe for me to interpret this as ‘if prop(key) is not present and “value” is not present, update the value’? Apologies but I am not understanding the question.

This seems to be a very important question I am not understanding the meaning of.

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/record-collection

The first part is talking about the argument passed in, about the values that the parameters of the function value and prop take (if the function call pass in prop a value that is not "tracks" and in value something that is not an empty string) - the second part is telling what to do with those arguments in the object

I’m sorry.I still don’t understand. Would you mind simplifying?

The function updateRecords has three parameters

It is asking you to check what are the values passed in when the function is called and do something depending on those values

For example the function call in your code is one example

prop here is “artists”, so it is not “tracks”, and value is not an empty string - so you need to update the record with those values