1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "Utf-8" />5 <title></title>6 <Scripttype= "Text/javascript">7 8 /*9 Ten through the program, output the following graphic in the page: One A * 1 <1 i=0 - * * 2 <2 I=1 - * * * 3 <3 i=2 the * * * * 4 <4 i=3 - * * * * 5 <5 i=4 - - ***** + ***** - ***** + ***** A ***** at - * * * * 1 j<5 (5-0) i=0 - * * * * 2 j<4 (5-1) I=1 - * * * 3 j<3 (5-2) i=2 - * * 4 j<2 (5-3) i=3 - * 5 j<1 (5-4) i=4 in - to */ + - //-------------------------------------------------------------------------------- the * //output a content to the body $ //document.write ("*****<br/>");Panax Notoginseng - the /*For (var i=0; i<5; i++) { + document.write ("*****<br/>"); A }*/ the + - for(varI=0; I<5; I++){ $ for(varJ=0; J<5; J++){ $ document.write ("* "); - } - //output a line break the document.write ("<br/>"); - }Wuyi the - //output graphics with a for loop Wu //this for loop executes several times, the height of the graph is how much - //It can be used to control the height of the graph About for(varI=0; I<5; I++){ $ - /* - * Create a loop inside the loop to control the width of the graphic - * Currently our external for loop executes 1 times and the internal is executed 5 times A * Inner loop can be used to determine the width of the graph, how many times the width of the graph is executed + */ the - for(varJ=0; J<I+1; J++){ $ document.write ("* "); the } the the the /*For (var j=0; j<5-i; j + +) { - document.write ("* "); in }*/ the the //output a line break About document.write ("<br/>"); the the the } + - the Bayi </Script> the </Head> the <Body> - - </Body> the </HTML>
JS Base _ Nested for loop