打印本文 打印本文 关闭窗口 关闭窗口
用 prototype 定义自己的方法
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2012  更新时间:2009/4/23 14:18:44  文章录入:mintao  责任编辑:mintao
p;   if(num<0)return NaN;
        if(num==0 || num==1)
            return 1;
        else
            return (num*(num-1).fact());
    }
  试验:alert((4).fact()) -> 显示 24
  这个方法主要是说明了递归的方法在 prototype 方法中也是可行的!

我编的一些字符串增强方法:http://www.blueidea.com/bbs/NewsDetail.asp?id=716195

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口