Blog for web developers

Create Pyramid structure from javascript

Create Pyramid structure from javascript

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.

Santosh Shah

I am a JavaScript developer having enthusiasm on most frontend skills like JavaScript, HTML, CSS, SASS, node, gulp, angular etc. I love exploring new techniques and like to learn new technologies to keep my self up to date.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.