Based on what's asked, would this function work?

Tell us what’s happening:

Based on what’s asked, would this function work?

If prop is “tracks” but the album doesn’t have a “tracks” property, create an empty array before adding the new value to the album’s corresponding property.

if (prop === id.tracks && id.hasOwnProperty(‘tracks’)) {

Link to the challenge:

no, id is a string, not an object, nor an array

plus, prop and id are variables, do to access object properties you can’t use dot notation that search for a property of literally that name, you need to use bracket notation

plus, push() will work only on existing arrays, if you don’t use it on array the code will error out and stop