Created
April 28, 2011 12:39
-
-
Save gotascii/946262 to your computer and use it in GitHub Desktop.
javascript quiz question
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
| function House() { | |
| this.vandalize = function() { | |
| this.vandalized = true; | |
| } | |
| } | |
| function Punk() { | |
| this.onParty = function(handler) { | |
| this.handler = handler; | |
| } | |
| this.party = function() { | |
| this.handler(); | |
| } | |
| } | |
| house = new House(); | |
| punk = new Punk(); | |
| punk.onParty(house.vandalize); | |
| punk.party(); | |
| console.log(punk.vandalized); | |
| console.log(house.vandalized); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment