3

Possible Duplicate:
Javascript: var functionName = function() {} vs function functionName() {}

What's the point of putting a function in a var or not?

var varFunc = function () {/*cool code*/};
function plainFunc() {
    /*cooler code?*/
}
Community
  • 1
  • 1
Devin Rhode
  • 23,026
  • 8
  • 58
  • 72

1 Answers1

1

Assigning a function to a variable, aka anonymous functions, can be pretty useful once you know what they do.

Check this out - http://helephant.com/2008/08/23/javascript-anonymous-functions/

David Ryder
  • 1,291
  • 5
  • 14
  • 27
  • 1
    But once it's assigned to a variable, it's no longer "anonymous" (consider that all "named" functions are simply function-objects accessed with a given property or variable name and their "name" is thus simply in how they are accessed). –  Jun 13 '11 at 05:08