Tell us what’s happening:
I know this is fairly easy to accomplish without the need to do a google search or ask for help on the forum,however im actually really stuck with Objects in general as they can be for my experience kind of confusing. I am trying to return the full object and i am certain that after the object constructor you have to do an if/else statement,however i do not know if i have to return the entire object or just the desired parameters
function updateRecords(records, id, prop, value) {
records = {
id:{
prop,
value
}
}
return records;
}
// 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) {
records = {
id:{
prop,
value
}
}
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/112.0.0.0 Safari/537.36 OPR/98.0.0.0
Challenge: Basic JavaScript - Record Collection
Link to the challenge: