Exposing a method which is inside a closure
When we are creating a method inside a closure it becomes private to that closure and can't be accessed until we expose it in some way. How can it be exposed? You can return a reference to it... var a = function() { var b = function() { // I'm private! alert('go away!'); }; return { b: b // Not anymore! }; }; See it on jsFiddle . You could also bind it to the window object . But I prefer the method above, otherwise you are exposing it via a global variable (being a property of the window object). You need to pass it to the outside in some manner. Example: http://jsfiddle.net/patrick_dw/T9vnn/1