Record Collection task missed?

I passed the test with this:

function updateRecords(id, prop, value) {
  collection[5439].artist = "ABBA";
  collection[5439].tracks = ["Take a Chance on Me"];
  delete collection[2548].artist;
  collection[1245].tracks = ["Addicted to Love"];
  delete collection[2548].tracks;
  collection[1245].album = "Riptide";
  return collection;
}

After passing I read the hint and realized that I had a wrong approach, didn’t I? I maybe just missed the task.

Yes, I’m afraid this is the entirely wrong approach, and if you are using this approach for all of the curriculum then you’re probably going to have to redo most everything.


As an example of why this is wrong:

say I want to add the track “Livin’ on a Prayer” to the album “Slippery When Wet”

updateRecords(2548, "tracks", "Livin' on a Prayer")

That should work, but your solution doesn’t allow me to do that. That’s because your solution is incorrect.


The tests are there to make sure your code works. You’re kinda missing the point of programming with your answer: you’ll pass the tests, but that’s it, you aren’t really doing any programming. The function needs to work for anything, not just the tiny sample of things in the tests.

1 Like

Thank you, I’ll try it again.