Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Created March 22, 2017 02:36
Show Gist options
  • Save StevenJL/c42492ba9742dfa1e947fcf20e8789ba to your computer and use it in GitHub Desktop.
Save StevenJL/c42492ba9742dfa1e947fcf20e8789ba to your computer and use it in GitHub Desktop.
ES6/arrowfunc
// 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