I don't know how to read this piece of code:
var byName = {};
ancestry.forEach(function(person){ byName[person.name] = person;]);
console.log(byName["Phil"]);
What I'm confused about is the "byName[person.name] = person" part of the code.
1) what does byName[person.name] mean? Why is square bracket notation used and not a dot notation?
2) Why is it equated to person (byName[person.name] = person) and how does that work?
ps: ancestry is a JSON file as a string that's available in the sandbox of my ebook.