Tell us what’s happening:
I can come up with the solution fine, but I like to read the hint section to see how what I wrote compares to the given solution.
After reading the solution, I found a part I don’t understand
if(collection[id][prop])
I understand this to return the actual data if there is any, and I would assume undefined if not. I can understand how undefined could be a false value, but how could say, an empty array be a true value?
if you used collection[1245]["tracks"]
for example.
I used the condition if(collection[id].hasOwnProperty(prop))
Because I understood this to be used when accessing properties and desiring a true/false return as demonstrated in a previous example… When should I choose to instead use the the given solution?
Thank you for your time.