Assignment 020a

For Loop and If Statement Combo

Another useful programming structure is the loop. JavaScript provides several ways to repeat commands easily. Let's start with the for loop. The following html was written with JavaScript:

In this example, you will place the loop within an if statement. If the user enters a valid number (1 or greater), then run the loop. Else, display a not-so-friendly message