Can someone please tell me why we get the various results with the following? I.e., how can I parse these to understand what's going on in Javascript underneath the hood to see why they give the results they do:
[{name: 'Joe', age: 30},{name: 'Frank', age: 20},{name: 'Ryan', age: 50}].map(({name}) => name)
// ["Joe", "Frank", "Ryan"]
[{name: 'Joe', age: 30},{name: 'Frank', age: 20},{name: 'Ryan', age: 50}].map((name) => name)
// [{name: 'Joe', age: 30},{name: 'Frank', age: 20},{name: 'Ryan', age: 50}]
I thought I knew how objects work, but obviously I need to understand this topic in more detail, as I don't see why the two statements provide the results they do.