Last active
August 29, 2015 14:07
-
-
Save flarnie/f671e874addb5c8bb594 to your computer and use it in GitHub Desktop.
ES6 Fat Arrow Functions
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
// ES6 "fat arrow functions" | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions | |
// One-line shorthand | |
var sayHello = (name) => console.log('Hello ', name); | |
// Multi-line example | |
var sayHelloTwice = (name) => { | |
console.log('Hello ', name); | |
console.log('Hi again ', name); | |
}; | |
// ES5 compatible syntax transpiled by es6-transpiler | |
// https://github.com/termi/es6-transpiler | |
// One-line shorthand | |
var this$0 = this; | |
var sayHello = function(name) { console.log('Hello ', name); }; | |
// Multi-line example | |
var this$1 = this; | |
var sayHelloTwice = function(name) { | |
console.log('Hello ', name); | |
console.log('Hi again ', name); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment