That will tell you each property you start with, and the ending value of collection. I can tell you, if tracks is not a property on the given member, you’re doing something wrong.
first off, as you can see I commented out those last two lines. All they do is add a prop called “id” with the value of whatever was in id and a prop called “prop” with the value of whatever was in prop to the collection object. It doesn’t break the tests, but it is a very bad and dangerous thing to do when you don’t mean to do it.
Now, to solve your actual problem. Consider how if/else if/else flows:
if (fred is true) {
do a thing then break out of the if statement
} else if (bob is true) { // only if fred was false
do a different thing then break out of the if statement
} else { //only if both fred and bob were false
do something else then break out of the if statement
}
do this thing after breaking out of the if statement
so consider that and look into what you are doing when “track” doesn’t exist.
So take a look at that the last entry, 5439. It did not have a tracks property, so the first branch of your if statement applies. What EXACTLY is that if block doing?
It creates an Array stored in a variable that you don’t need and never use.
It creates the tracks property on the right object, identified by id.
And… That’s it. Do you see someting missing there? If the tracks prop exists, you push the passed value onto the Array, but if you create the array that value is just… Poof-gone.