可以的,递归调用但是LZ的代码会造成死循环...
function Factor(n){
    if(n>0) return n*Factor(n-1);
    else return 1;
}alert(Factor(4));

解决方案 »

  1.   

    function a(){}的js可以通过用自己的名称掉用自己,如果是var a = function(){}这样定义的函数可以用arguments.callee方法掉用自己
      

  2.   

    调用自身建议使用arguments.callee
    function loopFun(x){
        if(x==1){
            return 1;
        }else{
            return x*arguments.callee(x-1);
        }
    }alert(loopFun(6));
      

  3.   

    function a()
    {
    var me=this;
    this.apply(this,arguments);
    }