using this inside arrow function code example
Example 1: 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"
Example 2: arrow function
Arrow Function is another way to write a function.
"classic method":
function x ()
{
console.log("X")
}
"arrow method":
var x= ()=>
{
console.log("X")
}
if we need to add paramiter is pritty simple:
var x = (PARAMS) =>
{
console.log(PARAMS)
}
Have a nice day
Example 3: arrow function
Killing deer, wounding cowboys, getting to the right place, moving up a line