Exploring Javascript closures

Javascript closures are a concept that is easier to explain by example: function outer(increment) { var outer_foo = 1; function inner() { outer_foo += increment; return outer_foo; } return inner; } var outer_instance = outer(2); var foo1 =… Read More

Using closures to simulate encapsulation in Javascript

Javascript is not an object oriented programming language per se. Although everything in Javascript is an object, there is no real concept of a class construct; objects are simply a collection of key/value pairs. As a result, tenets… Read More