Hi!
I think there’s if not an outright bug, then at least a bit of logical inconsistency in the problem statement. Look at the middle(3rd) item in the problem statement list:
If prop is tracks but the album doesn’t have a tracks property, create an empty array and add value to it.
Now consider for example the case where the first call our finished “updateRecords” function gets is: updateRecords(recordCollection, 5439, 'tracks', ''); The album with 5439 id didn’t have a “tracks” property, so in accordance with instructions our function will add “tracks” property to the album and set the value to [“”](i.e. a list with an empty string as its only member). But in all other cases a value equal to an empty string deletes a property instead of adding new one to album. It also doesn’t make much sense for a song/track to have empty string as its name. Also throughout my work on this problem I kept having this hunch that rearranging the if-conditions into a different order is something the problem setter wanted us to do. But it would be even more logical if value not empty condition was included in this list element just like in those before and after it. E.g. it could be phrased like this:
If value isn’t an empty string, prop is tracks but the album doesn’t have a tracks property, create an empty array and add value to it.
Yes, it is certainly not some very important/urgent issue. Even before I wrote the first message, my solution passed the tests. So, I’m pretty much only writing all of this out of pure academic interest.
There are two clauses which my example satisfies: the last one you quoted and the one in the middle I quoted before. TBH before reading your response I neglected the option of them being both executed one after another. Still writing programs in a way that first creates something only for it to be removed a few lines later seems like an odd behaviour.
I guess in a way this question boils down to whether if-statements in that list should be understood as mutually exclusive or not, i.e. should the if-statements also have else-clauses to connect them. Depending on the answer the function gives different results for the example I suggested: updateRecords(recordCollection, 5439, 'tracks', '');
It also in a way cascades into one’s ability to alter the order of the if-checks. In one case it is easier and has a better resulting code than in the other. I looked up the old topics about this problem and it seems a slight majority presumed mutual exclusivity like I did.
All in all, the instructions are slightly vague and that can IMHO lead to a bit of confusion. On the other hand, there are probably many bigger, more important issues out there.