Skip to content

Instantly share code, notes, and snippets.

@thomaseggum
Created March 15, 2012 13:35
Show Gist options
  • Save thomaseggum/2044229 to your computer and use it in GitHub Desktop.
Save thomaseggum/2044229 to your computer and use it in GitHub Desktop.
var mynamespace = mynamespace || {};
(function(){
var counter = 0;
function incrementCounter(){
counter ++;
}
mynamespace.someobject = {
counter : counter,
incrementCounter : incrementCounter
};
console.log("Should be 0 is.. "+mynamespace.someobject.counter);
mynamespace.someobject.incrementCounter();
console.log("Wish it would be 1.. is "+mynamespace.someobject.counter);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment