JavaScript anonymous functions and delegation, javascript anonymous Functions
<1>
<Html xmlns = "http://www.w3.org/1999/xhtml">
Javascript anonymous Functions
This is the function in the object,
Blog. blogSorter (b1, b2); // you can call this operation directly.
The object is a Blog,
BlogSorter is a function in a Blog object.
I understand.
Parameters of JavaScript anonymous Functions
In fact, all functions can pass parameters, depending on whether you have done the corresponding processing in the function body:
When an anonymous function has a form parameter, it can pass the corresponding real parameter:
(Function (a, B)
{
Alert (a + "and" + B );
}
) ("A", "B"); // return "a and B"
When an anonymous function does not have a parameter, you can use arguments to process it:
(Function ()
{
Var str = ""
For (I = 0; I <arguments. length; I ++)
{
Str + = arguments [I] + ",";
}
Alert (str );
}
) ("A", "B", "c", "d"); // return "a, B, c, d ,"