Many JS plug-ins begin with the Code (function ( which is not quite clear until you see
// Event Bindings this.bindHandler = (function () { if (Window.addeventlistener) {// Standard browser return function (Elem, type, handler) {// elem: node type: Event Type handler: event handler // the last parameter is true: Call event handlers in the capture phase false: Invoke event handlers in the bubbling phase elem.addeventlistener (Type, handler, false); } } else if (window.attachevent) {// ie Browser return function (elem, type , handler)  {   &NBSp; elem.attachevent ("On" + type, Handler) (          }    }) (); // Event Cancellation this.removehandler = (function () { if ( Window.removeeventlisterner) {// Standard browser return function (Elem, type, handler) { elem.removeeventlisterner (Type, handler, false); } } else if (window.detachevent) {// ie Browser return function (Elem, type, handler )  {     &NBsp; elem.detachevent ("on" + type, handler); } }) ();
Simplification into
A = (function () {return function (b) {alert (b); } })(); A (' $b $ ');
It's clear at one glance: The return value of the call function is the closure function
JavaScript method/Binding Unbind Event