Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

arguments.callee is deprecated in javascript 1.4. Use function name instead, so interpreter will have chance to perform tail recursion. Give names to your anonymous functions anyway: it will be much easier to trace them.

Example of anonymous recursive function with arguments.callee:

  var factorial=function(n) {
     return (!(n>1))? 1 : arguments.callee(n-1)*n;
  }
Example of anonymous recursive function without arguments.callee:

  var factorial=function factorial(n) {
     return (!(n>1))? 1 : factorial(n-1)*n;
 }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: