Basic Javascript Examples
Example 1: Scripts effectively add html code to your document
Example 2: This example printed the message in the alert box when you opened
this page...
Example 3: Using If Statements allow your script to respond to "environmental"
conditions of the browse or specific conditions inside your program by conditionally
executiong instructions if something is true.
Example 4: A common programming construct is the for Loop. This is
most often used to handle repetitions tasks, and to generate and regulate autonomous
processes.
Example 5: Another version of this same program can be done with the do/while
loop.
Example 6: Using Loops and conditional statements together is a key element
of many processes you will want to simulate which are not completely uniform
(ie. every step of the process is not exactly the same).
Example 7: An example using a for loop with an if and an else
if and else statement to do some more complicated formatting.