Skip to content

Instantly share code, notes, and snippets.

@CharlotteGore
Created March 28, 2012 13:22
Show Gist options
  • Save CharlotteGore/2226132 to your computer and use it in GitHub Desktop.
Save CharlotteGore/2226132 to your computer and use it in GitHub Desktop.
var panda = function () {
var bambooLevel = 0,
isAsleep = false,
wakeUp,
eatBamboo,
goToSleep;
wakeUp = function() {
isAsleep = false;
}
eatBamboo = function () {
bambooLevel = bambooLevel + 1;
};
goToSleep = function () {
isAsleep = true;
setTimeout(wakeUp, 1000);
};
return {
eatBamboo : eatBamboo,
goToSleep : goToSleep
};
});
var po = panda();
po.eatBamboo();
po.goToSleep();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment