Include all answers to all parts in one Word document. Remember to clearly label and spell-check your answers.
<html>
<body>
<script type="text/javascript">
<!-- ----PROGRAM BEGINS------- -->
// lines beginning with // are comments
// store text in variable
var message = " Hello World"
// variable for how many repetitions
var howmany = 5
// loop repeats indented lines
// until howmany stops being greater than 0
while (howmany > 0) {
// print in document
// + adds words together,
// <br> moves down a line
document.write(message + "<br>")
// decrease howmany
howmany = howmany - 1
}
<!-- ----PROGRAM ENDS--------- -->
</script>
</body>
</html>
Go to W3Schools.com's Tryit Editor or JS.do . Replace all the text in the box on the left with the code you just copied. Click the Run (or Run code) button to see what the program does.