<script>
function repeat(v) {
if (isNaN(v)) return;
document.writeln(v+"<br/>");
if (v<1) return;
//repeat(--v);
arguments.callee(--v)}
Number.prototype.repeat = repeat;
var num=10;
num.repeat(num);
</script>
function repeat(v) {
if (isNaN(v)) return;
document.writeln(v+"<br/>");
if (v<1) return;
//repeat(--v);
arguments.callee(--v)}
Number.prototype.repeat = repeat;
var num=10;
num.repeat(num);
</script>
callee 属性是 arguments 对象的一个成员,仅当相关函数正在执行时才可用。callee 属性的初始值就是正被执行的 Function 对象。这允许匿名的递归函数。
<script>
function repeat() {
if (isNaN(this)) return;
document.writeln(this+"<br/>");
if (this<1) return;
v=this
repeat.call(--v)
}
Number.prototype.repeat = repeat;
var num=10;
num.repeat();
</script>