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:

  1. Use a "while" loop or (better!) a "for" loop counting down
  2. Write the first line of the lyrics first, test your program
  3. 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.
  4. Make sure the page looks nice (put each verse in a paragraph, etc.)

At the end of the lab

CSci 1001 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.