Tell us what’s happening:
Describe your issue in detail here.
Your code so far
I don’t know where to start honestly. This whole thing is entirely confusing. Can someone explain how records is connected to the variable recordCollection? What to do in the 2nd question? " * If prop is tracks but the album doesn’t have a tracks property, create an empty array and add value to it." What should I do after else if prop == tracks? I seriously do not want to copy and paste everything with 0 comprehension. I want to learn more in detail. Please someone help?
// Setup
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'
}
};
// Only change code below this line
function updateRecords(records, id, prop, value) {
if(prop !== tracks && value !== ""){
records[id][prop] = value;
}
else if(prop === tracks )
return records;
}
updateRecords(recordCollection, 5439, 'artist', 'ABBA');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
The function call (the last line) says, in words, "run the function updateRecords with records = recordCollection, id = 5439, prop = 'artist', and value = 'ABBA'.
This doesn’t do what you think. You should see an error in the console. What does that error say?
I wrote exactly what the first question asked of me but not sure if I wrote this line correctly “records[id][prop] = value;”. I looked at the hint but never understood how records and recordCollection connect with one another. However, I look at the console and has many errors so not sure what issue could be?