参考代码:
var fn = function(i, n) { if (i == n) return; i++; for (var j = 0; j < i; j++) { document.write("* "); } document.write(""); fn(i, n);}fn(0,5);