Record Collection - Help

I’ve been struggling with the recod collection, watched videos and read blog posts both online and from the forum about more detailed instructions for this challenge. I’ve avoided looking at the answer and am pasting here to see if I can get some help or pointers on what I need to review. Thanks!

// 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) {

if (prop !== "tracks" && value !== "")
  prop === value
else if (prop === "tracks" && recordcollection.hasOwnProperty !==("tracks"))
else if (prop === "tracks" && value !== "")
else if (value === "")
  delete recordcollection.prop

  return records;

updateRecords(recordCollection, 5439, 'artist', 'ABBA');

HI @tyui78 !

I am about to log off, but I will give you a few tips on how to start fixing your code.

The first thing I notice, is that you are not using all of your parameters here

You are not using the id parameter and will need to for this challenge.

Another thing I noticed is that you referencing recordcollection inside your function.
You shouldn’t do that.

The goal is to create a resuable function that works for any object.
Not just recordcollection.
The first parameter of records should be used instead.

For each of the conditions, I would suggest tackling one of them at a time.

For the first one, you have the condition correct

but what is inside the condition is incorrect

saying prop is strictly equal to value isn’t going to help you here.
For here, you want to set that album’s prop to value .

You will also need to use records, id and prop here instead of just using prop on the left hand side.
Think about what records is meant to represent.
Think about what id is supposed to represent as well as prop.

Once you get that one, then you can move onto the second condition, and work from there.

It looks like you have bits and pieces of the correct answer, but you have clean up a couple of section to get it to pass fully.

record collection is one of the hardest challenges for beginners. But once you get it, then you will learn a lot in the process.

Good luck! :+1:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.