Tell us what’s happening:
Describe your issue in detail here.
First of all I have comprehension issues so if I missed anything super obvious from earlier lessons sorry. Also english isn’t my first language.
So, I’ve been stuck on this bad boy for an hour or so. I know what I need to do I think but I’m unsure of how I’m to do it. my code isn’t by any means close to done either, but I had questions that I couldn’t find the answers to so I decided it might be better to ask so I’m not tempted to cheat.
My main issue is that I don’t see where the object I’m supposed to edit is. I can’t just go value = prop but prop and value are only ever defined (I think but I might be chaotically wrong) in the updateRecords function. So how am I supposed to assign any of them to one another? Hint 2 said that to access the value in the object I need to use record[id][prop] but where is that? And What’s the difference between that and simply hasOwnProperty? And I need to create an array as well?
I’m sorry I’m embarassed to write all this out but I’ve gone back through the lessons but I just can’t see what this all is.
Your code so far
// 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) {
return records;
} if (value == "") {
delete
} else if (prop != tracks && value != "") {
value
}
updateRecords(recordCollection, 5439, 'artist', 'ABBA');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0
Challenge: Basic JavaScript - Record Collection
Link to the challenge: