JS - Recursion and Closures

Jonathan Logue
Mon, 26 May 2008 19:05:21 -0000

I am trying to figure out if it is possible to recursively call the
current outer function from within a closure while using the prototype
iterator. So...

var MyNS = {};

MyNS.Package = function() {}

MyNS.Package.prototype.myRecursiveFunction function(SomeComplexDataStructure) {

  SomeComplexDataStructure.DataPart.each( function(DataPart) {  ??how
do I call myRecursiveFunction??  } );

}

Thanks!