Skip to content Skip to sidebar Skip to footer

Difference Between 'var Foo = Function ...' And 'function Foo() ...'

Possible Duplicates: “Usual” functions vs function variables in JavaScript What do you call this JavaScript syntax, so I can research it? Is there a fundamental difference b

Solution 1:

They are different (but produce similar results). Basically, the first is an actual named function. The second is a regular variable declaration with an anonymous function attached to it. There are some subtle differences...they are summed up nicely here:

JavaScript Function Declaration Ambiguity (Be sure to read the comments too...more good info there)


Post a Comment for "Difference Between 'var Foo = Function ...' And 'function Foo() ...'"