Create 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("
")
}

Leave a Reply

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