Argument represents an array of arguments for the current function;
1, the use of callee:
Argument.callee indicates who referred to this function
Other explanations: ( Arguments.callee represents a reference to a function that is currently executing, or a function object that invokes Arguments.callee, which provides an anonymous function with a way of self-referencing. The concept can be better understood through the following examples. )
For example: Var fun=function () {
Console.log (Fun===argument.callee)
}
Fun (); True
Executing the above code, you can see that the result of the alter is true, note that "= = =" is used here, that is, Func is equal to the Arguments.callee object type and value.
Used on recursion, for example:
var r2= (function (n) {
if (n>1) {
Return N*argument.callee (n-1);
}else{
return 1;
}
}) (n)
2, the use of caller:
Returns a reference to the function that called the current function
Functionname.claaer
The FunctionName object is the name of the function being executed
For a function, Claller is defined only when the function is called, and if the function has a top-level invocation, then caller contains null, and if called in the context of the string, the caller property, then the result is the same as functionname.tostring , that is, the anti-compilation text of the function is displayed.
Code
Code highlighting produced by Actipro Codehighlighter (freeware) http://www.CodeHighlighter.com/-->//caller Demo {
function Callerdemo () {
if (Callerdemo.caller) {
var a= callerDemo.caller.toString ();
alert (a);
} else {
Alert ("This is a top function");
}
}
function Handlecaller () {
Callerdemo ();
}
Handlecaller ();//Popup Handlecaller definition
The understanding of callee,caller,argument in JavaScript