Created
November 18, 2014 11:08
-
-
Save attitude/6f32f5106c1b3d598abb to your computer and use it in GitHub Desktop.
Description for my my friend's IT colleagues to explain them how to leave door open/closed properly.
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
/*! Closing the Door by Martin Adamko (c) 2014, MIT Licence */ | |
var officeOfHelena = { | |
person: { | |
name: "Helena", | |
surname: "Székhelyi" | |
} | |
}; | |
(function(office) { | |
var door = { | |
degree: 45, | |
openDoor: function(degree) { | |
this.degree = degree; | |
return this; | |
}, | |
closeDoor: function() { | |
this.degree = 45; | |
return this; | |
} | |
}, | |
API = { | |
enterOffice: function(openDegree, afterDegree) { | |
if (afterDegree === 45) { | |
door.openDoor(openDegree).closeDoor(45); | |
alert("Come in!"); | |
return true; | |
} | |
alert("Try again, make sure the 2nd argument passed is 45."); | |
return false; | |
} | |
}; | |
office.doorAPI = API; | |
}(officeOfHelena)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment