Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Panda: without context splurge, callbacks or base library.
var panda = (function () {
var panda = {}, bambooLevel = 0, isAsleep = false;
function wakeUp() {
isAsleep = false;
panda.eatBamboo = function () {
bambooLevel = bambooLevel + 1;
panda.goToSleep = function () {
isAsleep = true;
setTimeout(wakeUp, 1000);
return panda;

This comment has been minimized.

Copy link
Owner Author

@leecrossley leecrossley commented Mar 28, 2012

If you wanted to, instead of declaring "isAsleep" as a local variable, you could do panda.isAsleep is make it accessible outside in the wild. I've kept it in it's cage though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment