If person.nicknames isn't defined for some reason, an exception will be thrown, meaning this (anonymous function) will be at the top of the stack trace.
Honestly, the anonymity of => arrow functions is a => dagger to the heart, for me. I cannot abide by the loss of naming. It's harder to read, harder to debug, and impossible to self-reference.
^ All good points
What about?
Const getPreferredName = person => person.nicknames[0] || person.firstName;
people.map(getPreferredName);
Aside from the other underlying problems with arrow functions that you mention (no "this", different syntax ) the function name well still show up in stack trace if there is an error, but maybe I'm missing something else?
Thank for putting out more great content! I tried a few FP books and yours was the first that was actually approachable!
Chapter 2 - Functions Without function
^ All good points
What about?
Const getPreferredName = person => person.nicknames[0] || person.firstName; people.map(getPreferredName);
Aside from the other underlying problems with arrow functions that you mention (no "this", different syntax ) the function name well still show up in stack trace if there is an error, but maybe I'm missing something else?