Brief Intro to Arrow Functions

Evidently, one of the most celebrated additions to JavaScript a short three or so years ago (version ES6/ES2015) was the introduction to the Arrow Function. (I've also seen it referred to as the fat arrow function.)

A simple explanation of what an arrow function accomplishes is that it cleans up your function code to be more concise, less messy looking by using shorter syntax.

Pretty cool! The only difference between the double and sum syntax is we added the parentheses back in when there was more than one parameter to apply. You can still include the parentheses if there is just one parameter, but they're optional.

There are some other cool features of the arrow function that slightly differ from regular functions (most notably while using the 'this' keyword), but we can delve into that in a later post. :)

That does not mean that the JavaScript community knew what they're talking about. ;-)

Additionally to my personal and probably debatable perception that referring to a certain lambda notation as an "arrow function" because an arrow is involved is like referring to a C pointer as an "asterisk variable" because an asterisk is involved, I would say const whatever = num => num * 2is a lambda function because the return value is used for output, not just discarded...?

It's named, so what is the distinction between this syntax and a "normal" function declaration? Both can be passed around as first class citizens so what is it about the arrow function that would make it a lambda, but not the function declaration?

In this case, the return value is discarded but I think that arrow function still qualifies as a lambda expression because it's anonymous and because of how it's used. I used "splice" in this example because it does mutate the array, but even if it were a "slice" instead I think it would have to be considered a lambda...though, not a useful one!