Callee
Callee is a property of an object that is a pointer to a function that points to a parameter arguments object
First, let's write a step-up function:
function Chen (x) {if (x<=1) {return 1;} Else{return X*chen (x-1);};};
From this function can be seen, the use of recursive function, if changed the function name, inside the function name also with the change, this is very inconvenient so we use callee to try
function Chen (x) {if (x<=1) {return 1;} Else{return X*arguments.callee (x-1);};
Let's analyze why this is written: according to the definition of callee, it can be seen that callee is a property of the arguments object, a function that points to the arguments object, which is Chen (chen=arguments.callee ), so the explanation should be understandable.
Caller
Caller is a property of a function object that holds a reference to the function that called the current function ( the direct parent function that points to the current function)
Let's start with an example.
function A () {B ();}; Function B () {alert (b.caller);}; A (); The result is a popup function A and the contents
Let's explain, first of all, the property of function B caller calls the function of the current function B to reference a (that is, to the parent function A of the current function B), so the result is a popup function a () {B ();};
So you know caller and callee, then you can not combine the two together to use it
Function B () {alert (b.caller);};
From this code you can see that the B function called the B function name, so that when the function name changes is inconvenient, we need to replace the inside of the B
Before we know what method can point to the current object, let's modify it as follows:
(function A () {B ();}) (); function B () {alert (arguments.callee.caller);};
Js--callee and Caller