Tell us what’s happening:
The challenge makes the requirement that " * If prop
is tracks
but the album doesn’t have a tracks
property, create an empty array and add value
to it."
The object has an id, 5439, that does not contain a tracks key, so I created one line of code to execute the demand above, but the actual “guide” page has a different line of code listed. I just want to know if my code is accomplishing the same thing with a different method.
Your code so far
the GUIDE code says
else if (prop === “tracks” && !object[id].hasOwnProperty(“tracks”)) {
collection[id][prop] = [value]
}
MY code says
else if (prop === “tracks” && id !== “tracks”) {
collection[id][prop] = [value]
}
Now, is my code executing the same command or is it doing something different? Thanks.
User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36</code>.
**Challenge:** Record Collection
**Link to the challenge:**
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/record-collection