Regarding function expressions, you've omitted to mention that you can name functions defined in this manner - and in fact it can be a good idea to do so. If they are not named they will show up as 'anonymous' functions in stack traces. So, it is equally valid to write:
Regarding function expressions, you've omitted to mention that you can name functions defined in this manner - and in fact it can be a good idea to do so. If they are not named they will show up as 'anonymous' functions in stack traces. So, it is equally valid to write:
In this case, stack traces involving the function will show the name
calculateAge
instead of 'anonymous function'Thank you so much for correcting that, Jon! I will add that part.
Just wanted to show the difference as basics without confusing the newbies, because I was not touching other function types in this article. 😂
I don't disagree with your premise in the least - I prefer explicitly named functions as well.
However introduced with ES2015: