Introduction
Let us learn the differences between a traditional function and an arrow function expression in JavaScript? If not, then pr...
For further actions, you may consider blocking this person and/or reporting abuse
This isn't really explained clearly. You have missed that you can also assign named functions to a variable:
This can actually be a good idea sometimes as (depending on the environment), stack traces can be easier to read if you give functions names. You are correct in stating that a function's name cannot be changed after the function is defined though.
While writing this post I discovered that (at least in Chrome and Firefox) - if you create an 'anonymous' function in an assignment, it is not actually anonymous - it has the variable's name automatically given to it at the time of assignment:
So, it would seem that true anonymous functions are ones that are created outside of an assignment:
Thanks for the feedback! I'll make sure to make some changes.
You have an error in your arrow function examples. When omitting the curly braces
{}from an arrow function body, i.e., single-line arrow functions, the results are automatically returned. (This, by the way, is a great feature of arrow functions as it reduces code.)a => return a + 100;should bea => a + 100;Iām new to JavaScript but this helped clear out overall doubts regarding this :)