Possible Duplicate:
JavaScript: var functionName = function() {} vs function functionName() {}
What is the difference between these 2 function syntax types
In JavaScript, we can define a function, which will be called at a later time, using one of the methods below. That is, using a named function and assigning an anonymous function to a variable.
function myAdd(a, b) {
console.log(a + b);
}
myAdd(3, 2);
var mySubtract = function (a, b) {
console.log(a - b);
}
mySubtract(3, 2);
Are they basically always identical? By identical, I mean no special contexts that might make them different. For example, it turns out multiple left-hand assignment has some subtleties that might lead to a different result depending on the context.