
In this article, I am going to show you how to create a pyramid structure from javascript.
Create Pyramid structure from javascript simple nested loop
var rows = 10 for(var i=0; i<=rows; i++){ for(var k=1; k<=rows-i; k++){ document.write(" ") } for(var j=0; j<=i; j++) { document.write("* "); } document.write("
") }
The above code with return a pyramid structure as shown in featured image.
Leave a Reply