peterS.: Vererbung

Beitrag lesen

gruss Andreas,

was macht denn ".callee"?

".callee" ist eine eigenschaft des fuer jede funktion vorhandenen
   "arguments"-objekts, die eine referenz auf ebendiese funktion
   enthaelt  -  am beispiel:

var Mensch = function (name) {
     this.constructor = arguments.callee; /* ist aequivalent zu
     this.constructor = Mensch; */
   //alert("(arguments.callee == Mensch) ? " + (arguments.callee == Mensch));
   };

und hier die worte der ECMA spezifikation 262:

10.1.8 Arguments Object

When control enters an execution context for function code, an
     arguments object is created and initialised as follows:

• ...

• A property is created with name callee and property attributes
     { DontEnum }. The initial value of this property is the Function
     Object being executed. This allows anonymous functions to be
     recursive.

• A property is created with name length and property attributes
     { DontEnum }. The initial value of this property is the Number
     of actual parameter values supplied by the caller.

• ...

der fuer mich wichtigste satz lautet:

"This allows anonymous functions to be recursive."

by(t)e by(t)e - peterS. - pseliger@gmx.net

--
ie:( fl:) br:> va:| ls:& rl:| n4:} ss:} de:µ js:} zu:]