var num=1*prompt("输入行数");//显示的金字塔行数for(var i=0;i<num;i++){ for(var j=0;j<2*i+1;j++) { document.write("*"); } document.write("<br>");}