We already know that IIFE means Immediately Invoked Function Expression..
It is the happening of declaration plus invocation at the same time.
So we declare and invoke the function right away.
For more see immediately-invoked-function-expression
A very useful and practical technique which is a kind of declarative interface for hiding our imperative code using a simple Inversion of Control mechanism.
For more see higher-order-functions
Register a function when the operation is asynchronous so we get the result of our registered function later on.
9. Arrow Function
New ES6 function that has no this binding.
With arrow function, if we assign it to an object as a property (we call this method); then this method has no access to this!
It is mostly useful for passing it around as an argument to a function and when we do not need to bind this.
Very powerful mechanism or technique or pattern that captures reference to the outer scope data / function for later use case or execution.
Closures are very useful and have many use cases like:
- lazy evaluation or lazy algorithm
- partial application
For more see get-comfortable-with-closure
Update: Thu Sep 05 2019 19:20:17 GMT+0430 (Iran Daylight Time)