Created
November 2, 2013 18:35
-
-
Save mateuszkocz/7282033 to your computer and use it in GitHub Desktop.
Fat arrow function. Source: http://robcee.net/2013/fat-arrow-functions-in-javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var listener = node.addEventListener("click", function(event) { | |
let _target = event.target; | |
this.handleClick(_target); | |
}.bind(this)); | |
//Inside we call a local method called handleClick() with the event’s target property. Nothing too exciting. | |
//With Fat Arrow Functions, that becomes: | |
var listener = node.addEventListener("click", (event) => { | |
let _target = event.target; | |
this.handleClick(_target); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment