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

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

nginx - phpPgAdmin - log in works but I have to login again after clicking on any links -