Hello,
I've been poking around a bit in the jQuery source code. It's been enlightening and has proven that I don't know as much about _javascript_ as I thought I did!

Here's a pattern that occurs frequently that I'm really curious about:

new function() {
   // do stuff
}

Is the purpose of this just to provide local scope to the variables used? Is there an equivalant syntax that may be more common? I intuitively wouldn't even think the code inside the function would get executed unless the whole thing was proceeded by "()", but obviously I'd be wrong. What's really surprising is that I couldn't find any information about this technique in a google search.

Just curious.

Thanks,
Todd
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to