Fat Arrow Functions JavaScript Programming Tutorial




Lesson Code: http://www.developphp.com/video/JavaScript/Fat-Arrow-Functions-JavaScript-Programming-Tutorial

Crash course on using the new Arrow functions in JavaScript, introduced in ECMAscript Edition 6 to provide a new approach to writing anonymous functions. Arrow functions have 2 major advantages over traditional anonymous functions. (a) They reduce the amount of code you need to write. (b) In object oriented programming, the “this” keyword always refers to the object no matter how many anonymous functions are nested in the class. We will demonstrate these concepts through code right now starting with the most basic.

They are Anonymous functions. Anonymous functions are functions that have no name like normal functions do. We see them used as parameters in methods that expect exectuable code as an argument. Anonymous functions are used in object oriented programming, or they are sometimes supplied as the value of a named variable.

We will compare traditional Anonymous function syntax with arrow function syntax side by side using several simple examples in order to demonstrate where, when and how to use arrow functions where you normally use anonymous functions.

Original source


39 responses to “Fat Arrow Functions JavaScript Programming Tutorial”

  1. Thanks, Adam, for the video. It helped a lot.

    I like the new fat arrow function, but I'm not a big fan of omitting () when there is only one variable passed to an anonymous function.

    Seeing () or (…) makes it stand out more as a function, especially during transition to this new feature. It's more explicit, but still more brief than the original syntax.

    Where I really see this feature stand out is the fact it is truly "anonymous" (i.e. not having its own "this"), without having to work around it with clunky "self" or "that" code, which is certainly not more readable or intuitive.

    Thanks, again.

Leave a Reply