[Javascript] Various types to create functions - I am confused

Noah Sussman noah at onemorebug.com
Thu Oct 4 07:32:39 CDT 2007


On 10/4/07, JS Student <tuofamerikazmostwanted at gmail.com> wrote:
> These are the various methods to create functions in JavaScript:
>
> var foo = new Function();
> var bar = Function();
> var baz = function() {}
> function zag() {}
>

And don't forget inline anonymous function calls (at least that's what
I've been calling them):

(function() {})()

Allows you to declare and call a singleton function, without adding an
extra variable name to the namespace.

Thanks Robert and liorean for already providing very informative
answers to the OP's question.

-- 
Noah Sussman
Noah_|_OneMoreBug.com

"the lyfe so short, the craft so long to lerne"  --Chaucer



More information about the Javascript mailing list