Basic JavaScript - Record Collection

I am struggling with the Record collection challenge…
I dont know what to do. Please advice or help me understand it if you can.

Your code so far

Please post your code so far and the link to the challenge. Thanks

I dont have any code so far…


Ok, can you talk a little about which word or words in the instructions you need explained further?

Do you know what tihe function arguments all mean?

Do you know what the function needs to do?

Thanks for replying. I have tried again and have come up with this so far. I am unsure how to do the last part.

function updateRecords(records, id, prop, value) {
if(value === ""){
  delete records[id][prop];
}else if(prop != "tracks" && value != ""){
  records[id][prop]= value;
}else(prop === "tracks" && value != "");{

  return records;

updateRecords(recordCollection, 5439, 'artist', 'ABBA');`

The instructions talk about ‘if there is no tracks array’. How might you you check for the tracks property?

I am not sure how… :see_no_evil:

Luckily there’s a big old list of things you’ve done with objects here

Does one of these in this list look like it might help? Testing objects for properties?

Oh!! Thank you. Sorted. Thank you for your help!!

1 Like

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