Hello guys! Here I have such a problem, to make a pyramid out of numbers, and I sit for an hour and never get to me how to do it.

Here is the actual code:

<center><script> for (var i=1; i<=29; i++) { document.write(' '+i+' '); if (i%5>=4) {document.write('<br>');}; }; </script></center> 

Just do not write abstruse codes :). I only went

  • confirm
  • prompt
  • var * = prompt
  • for
  • alert
  • document.write
  • переменные
  • Are there any conditions? kind of to-tv figures, strings, etc.? - gothmog

1 answer 1

No cleverness, pure logic:

 for(var i = 1;i <= 29; ++i) { for(var j = 1; j <= i; ++j) document.write(' '+j+' '); document.write('<br>'); }; 

It does not matter that you have passed. You always have to go further.