Last active
March 7, 2016 18:44
-
-
Save mageddo/12702f0d08e8b495efec to your computer and use it in GitHub Desktop.
Javascript "Lambdas"
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
// with functions | |
var Person = function() { | |
this.say = message => console.log('you said: ', message); | |
this.getOnHand = (hand1, hand2) => { | |
console.log(hand1, 'at left hand'); | |
console.log(hand2, 'at right hand'); | |
} | |
}; | |
var p1 = new Person(); | |
p1.say('Hello!'); | |
p1.getOnHand('Apple', 'Orange'); |
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
// with functions | |
var Person = { | |
say: message => console.log('you said: ', message), | |
getOnHand: (hand1, hand2) => { | |
console.log(hand1, 'at left hand'); | |
console.log(hand2, 'at right hand'); | |
} | |
}; | |
Person.say('Hello!'); | |
Person.getOnHand('Apple', 'Orange'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment