Possible Duplicates:
When to use anonymous JavaScript functions?
Is there any difference between var name = function() {} & function name() {} in Javascript?
in javascript (and other scripting languages) what is the ‘real’ difference between these two syntax:
a) function myFun(x) { yadda yadda }
b) myFun(x) = function { yadda yadda }
to a casual observer – no ‘real’ difference – you still call either as myFun()…and they still return the same thing, so if reference and return are identical – is it a preference or is there some difference in the code parsing engine that treats these two differently – and if so – when would you use one over the other???
The real, super-secret difference:
The former syntax hoists the function such that (although arguably bad practice) it can be called before its actual line in the code. The latter syntax requires you to declare the function first.