Created
March 22, 2017 02:36
-
-
Save StevenJL/c42492ba9742dfa1e947fcf20e8789ba to your computer and use it in GitHub Desktop.
ES6/arrowfunc
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
// Use the arrow notation to create anonymous functions | |
[1 , 3, 4, 5].map(v => v + 1) | |
evens = [] | |
[1, 2, 3, 4, 5].forEach(v => { | |
if (v % 2 == 0) | |
evens.push(v) | |
}) | |
// Use the arrow notation to create named functions | |
greeter = (name) => { | |
console.log("Hello " + name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment