CSci 1001 Lab 4: JavaScript Loops
For this lab please team up in pairs
Study the following examples:
Printing numbers using loops,
Drawing lines using loops
Task 1: Using a loop to write song lyrics
Write a loop to print the lyrics of the song
99 Bottles of Beer. The last verse should print "Take one down and pass it around, 0 bottles of beer on the wall".
Some hints:
- Use a "while" loop or (better!) a "for" loop counting down
- Write the first line of the lyrics first, test your program
- Write the second line of the lyrics without changing the loop variable. Test your program to make sure it still prints all of the verses correctly.
- Make sure the page looks nice (put each verse in a paragraph, etc.)
- For a bit of extra credit add a prompt to ask for the starting number of bottles, then print the song counting down from that number.
At the end of the lab
- Send your html files by e-mail to me elenam at
morris.umn.edu and to yourself.
- If you are not finished with all tasks, you may continue working
on the lab at home. In this case please submit it with your problem set.
CSci 1001 course web site.