Skip to content

Instantly share code, notes, and snippets.

@lricoy
Last active March 23, 2016 01:52
Show Gist options
  • Save lricoy/94375e4f81afdf9573d4 to your computer and use it in GitHub Desktop.
Save lricoy/94375e4f81afdf9573d4 to your computer and use it in GitHub Desktop.
ES2015 features
// Expressões (Expression bodies)
var odds = evens.map(v => v + 1);
var nums = evens.map((v, i) => v + i);
// Declarações (Statement bodies)
nums.forEach(v => {
if (v % 5 === 0)
fives.push(v);
});
// Referência léxica ao *this* (Lexical this)
var bob = {
_name: "Bob",
_friends: [],
printFriends() {
this._friends.forEach(f =>
console.log(this._name + " knows " + f));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment