function callee object

Description

arguments is an array-like object containing all of the arguments passed into the function.

arguments has a property named callee, which is a pointer to the function that owns the arguments object.

Example


function factorial(num){/*w ww.  ja  v  a2 s .  c o m*/
   if (num <= 1) {
       return 1;
   } else {
       return num * arguments.callee(num-1)
   }
}
var trueFactorial = factorial;

factorial = function(){
   return 2;
};

console.log(trueFactorial(5));   
console.log(factorial(5));     

The code above generates the following result.





















Home »
  Javascript »
    Javascript Introduction »




Script Element
Syntax
Data Type
Operator
Statement
Array
Primitive Wrapper Types
Function
Object-Oriented
Date
DOM
JSON
Regular Expressions