Tell us what’s happening:
Hi there,
Please i’ll like to know where within my code which doesn’t make the code to solve the challange. Especially with this “After updateRecords(2548, “artist”, “”), artist should not be set”. I don’t seem to get it.
Thanks very much!
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"
}
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));
// Only change code below this line
function updateRecords(id, prop, value) {
collection["5439"].artist = "ABBA";
var track = collection["5439"].tracks = [];
track.push("Take a Chance on Me");
collection["1245"].album = "Riptide";
collection["1245"].tracks.push("Addicted to Love");
collection["2548"].artist = "";
return collection;
}
// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/record-collection