javascript call arrow function immediately code example
Example 1: immediate invoke function js
(() => {
// statements
})();
Example 2: Immediately-Invoked Function javascript
(() => {
/* */
})()
Example 3: javascript this inside arrow function
function A() {
this.val = "Error";
(function() {
this.val = "Success";
})();
}
function B() {
this.val = "Error";
(() => {
this.val = "Success";
})();
}
var a = new A();
var b = new B();
a.val // "Error"
b.val // "Success"