javascript - Fat arrow function and how a fat arrow function works -
this question has answer here:
i saw question in quiz, how fat arrowed question works? there difference in following code, if if yes why, if no why?:
var abc = function() { return { log : function() { console.log(this.val); } }; } var def = function(){ return{ log : () => { console.log(this.val); } }; }
a fat arrow function automatically binds this
. avoid code have save this
in other variable that
... such in nested callback hell. more terse.
Comments
Post a Comment