Tell us what’s happening:
I really struggle with the wording of some of these problems. I don’t understand what this is asking me to do , I’ve specified below which bits don’t make sense to me.
If prop
isn’t "tracks"
and value
isn’t empty ( ""
), update or set the value
for that record album’s property. - To what?
If prop
is "tracks"
but the album doesn’t have a "tracks"
property, create an empty array before adding the new value to the album’s corresponding property - What new value?
If prop
is "tracks"
and value
isn’t empty ( ""
), push the value
onto the end of the album’s existing tracks
array. - What value am I pushing on to the end of the array? It already has values, what others am I supposed to be adding?
I haven’t added any code yet because I don’t understand the question. Thanks for any help you can give me!
Your code so far
// Setup
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"
}
};
// Only change code below this line
function updateRecords(id, prop, value) {
return collection;
}
updateRecords(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/80.0.3987.149 Safari/537.36
.
Challenge: Record Collection
Link to the challenge: