Section 24.4. Arguments.callee: the function that is currently running


24.4. Arguments.callee: the function that is currently running

ECMAScript v1

24.4.1. Synopsis

 arguments.callee 

24.4.2. Description

arguments.callee refers to the function that is currently running. It provides a way for an unnamed function to refer to itself. This property is defined only within a function body.

24.4.3. Example

 // An unnamed function literal uses the callee property to refer // to itself so that it can be recursive var factorial = function(x) {     if (x < 2) return 1;     else return x * arguments.callee(x-1); } var y = factorial(5);  // Returns 120 




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net