I’m currently stuck on challenge # 210, record collection. Can anyone help me out with this?
What exactly you need the help with?
Sorry for the late response. Well, I keep getting the error: “TypeError: Cannot read property ‘ABBA’ of undefined”
Here’s my function:
function updateRecords(id, prop, value) {
if (collection[id][prop] == “tracks” && collection[id][prop][value] === “”) {
arr.collection[id].tracks.push();
}
if (collection[id][prop] == “tracks” && collection[id][prop][value] !== “”){
arr.collection[id].tracks.push(value);
}if (collection[id][prop][value] === “”){
delete collection[id][prop];
}
return collection;
}
Assuming test case updateRecords(5439, "artist", "ABBA");
In your first if your check looks like this:
if (collection[5439]["artist"] == "tracks" && ...
But collection doesn’t have "artist" property for id 5439 so you get an error.
From the challenge’s description:
If prop isn’t “tracks” and value isn’t empty (“”), update or set the value for that record album’s property.
So you should check
if (prop !== "tracks" && value !== "") {...
and so on…
I wrote a similar post in another thread, but SPOILER ALERT it includes solution: Record collection challange - #49 by jenovs - JavaScript - The freeCodeCamp Forum
Sorry again for the late response, university has me running circles lol
Thank you so very much for the help! That fixed it for me 