Possible Duplicate:
Javascript: var functionNam开发者_运维百科e = function() {} vs function functionName() {}
Is there any difference between these two ways of declaring a function?
They are both anonymous functions, only one is assigned to a variable named x
.
I think you may be trying to refer to what is known as function expressions and function declarations.
x = function(a, b, c){}
assigns the function to the alias x
so you would execute it using x(a, b, c)
. The second is an anonymous function that would not be accessible after the place that it was declared as it is not assigned to anything.
精彩评论