Something Like that:
for loop
Pyramid in javascript
For that you need to create first html code.
HTML
No need any html code because this will be write in your document.
After that add this JS code.
JS
for(i=0; i<=10; i++){ for(x=0; x<=i; x++){ document.write("#"); } document.write("
"); }
[codepen_embed height=”265″ theme_id=”0″ slug_hash=”YxyYjK” default_tab=”result” user=”pradeepanvi”]See the Pen Pyramid in javascript by Pradeep Kumar (@pradeepanvi) on CodePen.[/codepen_embed]
Now you can see
#
##
###
####
#####
######
#######
########
#########
##########
###########
But One thing Now I want this should be rotate.
##########
#########
########
#######
######
#####
####
###
##
#
After that add this JS code.
JS
for(i=10; i>0; i--){ for(x=0; x<i; x++){ document.write("#"); } document.write("
"); }
[codepen_embed height=”265″ theme_id=”0″ slug_hash=”prjZZg” default_tab=”result” user=”pradeepanvi”]See the Pen Rotate Pyramid in javascript by Pradeep Kumar (@pradeepanvi) on CodePen.[/codepen_embed]