ok I have set the condition of the if property to check if that is has it, and I passed everything but 5 and 6 .
5. After updateRecords(recordCollection, 1245, "tracks", "Addicted to Love"), tracks should have the string Addicted to Love as the last element.
6. After updateRecords(recordCollection, 2468, "tracks", "Free"), tracks should have the string 1999 as the first element.
What’s wrong is that you are not adding to the end of the array that already exists. You are destroying the array that already exists and replacing it with value.
oh. I didn’t even know I could do that. I figured you would have to delete it like I did in the first if statement and make another. Ig that’s a cool trick to keep in mind, but how do I fix this? I see this in my code, which I think adds a value to a property, but when I enter this format for the other statement, it fails.:
That right there destroys what ever was previously stored in records[id][prop] and completely replaces it.
Again, you need to add to the end of an array. You have already written a command once to do this. If you forgot what you wrote, I’d look back through this tread or ask Google “JS how to add element to array”.
Don’t focus on the tests. Focus on getting the logic correct.
I will sit with this for a little while, I really want to figure this out beyond this project, Im struggling with the concept. Maybe researching will help clarify the logic
I see now that prop is already representing tracks, so there’s no need for the .tracks. what I want to do is add to the array , so I need the array adding methods like un/shift and pop/push. I have passed, thank you so much