PDA

View Full Version : about the ext-base-debug.js



ethantsien
12 Sep 2009, 2:19 AM
i can't understand the code
(function () {})(); in ext-base-debug.js

:((

what does it mean?

Condor
12 Sep 2009, 4:18 AM
This defines a function:

function () {...}
and this calls that function:

(fn)();

It's a way to create private code (all variables defined inside are only accessible from within the closure).

bt_bruno
14 Sep 2009, 3:04 AM
In addition:

Secrets of JavaScript closures (http://www.kryogenix.org/code/browser/secrets-of-javascript-closures)
Javascript Closures (http://www.jibbering.com/faq/faq_notes/closures.html)