Function literal (Definition)

A way of creating functions on the fly within your script.

JavaScript version 1.2 introduces a genuine literal syntax for creating anonymous functions.

Previously we might have used a function constructor and assigned the result to an object. This is more simple and straightforward. It looks just like a normal function declaration, except that there is no name defined for the function.

Example code:

   // An example function literal
   var cube_value = function(a) { return a*a*a; }

See also:Anonymous function, Function call operator ( ), function( ... ) ...