Created
June 15, 2015 15:49
-
-
Save himynameisdave/1d1ae29a41b92f81da1f to your computer and use it in GitHub Desktop.
Object Literal w/this keyword
This file contains 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
var juicer = { | |
fruit: "oranges", | |
amount: 5, | |
juice: function(){ | |
alert( "You have juiced " + this.amount +" "+ this.fruit ); | |
} | |
}; | |
// Calling juicer.juice(): | |
// -> "You have juiced 5 oranges" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment