JavaScript Anonymous Functions

Last Updated Jul 29, 2015, 07:00:14 PM





JavaScript Anonymous Functions

An anonymous function is a function without a function name:

An anonymous function is a function that is not stored in a program file, but is associated with a variable whose data type is function_handle. Anonymous functions can accept inputs and return outputs, just as standard functions do. However, they can contain only a single executable statement


Anonymous function declaration
Example
Try It Now

Another Way to Declare the Anonymous



Try It Now

The most common use for anonymous functions are as arguments to other functions, or as a closure.



Other JavaScript functions you might want to learn

JavaScript functions with paramters

JavaScript named functions

JavaScript Inner functions

JavaScript Recursive functions


Sources and Credits

The source of the content has been referred and updated with Mozilla Developer Network and W3C Organization

Last Updated Jul 29, 2015, 07:00:14 PM





Browser compatibility

Feature
Basic support Yes Yes Yes Yes Yes Yes Yes