javascript - Fat arrow function and how a fat arrow function works -


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

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -