Skip to content

Instantly share code, notes, and snippets.

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