Record Collection is not spinning well

Tell us what’s happening:
am totally lost as to what to do for this coding exercise…the previous lessons were so easy compared to this and i am totally lost, despite restarting my progress to relearn the material.

creating the if / else statements is not so bad but why do i need to use the !== instead of !=, when other lessons had us using !=?

some insight as to how i should be thinking would be super helpful, as this is super frustrating…

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) {
  if (prop !== 'tracks' && value !== '') {
    return collection[id][tracks].
  }
  
  return collection;
}
`
// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/record-collection

The difference between !== and != is small but important to know even if in this case I don’t think there is any difference

1 != '1' // false
1 !== '1' // true

!== strict inequality compare the two elements as they are, != instead do type conversion

1 Like

thanks for your reply!

i am also totally confused as to how / where to push what to where and when to pull…

perhaps thinking like a coder is going to take a lot of work…and i really do not want to look at the answers just to complete the problem.

Remember that push works only on existing arrays, and that the only property that should be an array is tracks

thanks!

in the end, had to break down and look at the answer…this was way too difficult to understand, spent over an hour just trying to decipher the answer because that was also super confusing…

thank you for your help!

I suggest in a couple of days you try again to solve it on your own without looking at the answer!

1 Like

on youtube right now trying to find a way to understand it…
funnily enough, some peoples answers are not working in my code editor despite working in theirs…hmmm…

anyways, am trying to figure it out, and again, thanks for all your help!