Answer to Section 7.25 Write a JavaScript Program for the following problem.
Write a script that outputs XHTML text that displays the following checkerboard pattern:
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
Your program may use only three output statements to display the pattern, one of the form
document.write( "* " );
one of the form
document.write( " " );
and one of the form
document.writeln(); //writes a newline character
You may use XHTML tags (e.g., <pre>) for alignment purposes. [Hint: Repetition structures are required in this exercise.]
Back to chapter 7