Note 4 for Web Scripting
Watch & Read:
Array is a variable on steroids. (Array's have several values under the same variable name.) You have to declare an array!
var mynewarray= new Array()
mynewarray[0], mynewarray[1],mynewarray[2] Notice the array number starts with 0.
Conditional Statements (Javascript's method of testing the environment)
if (condition)
{ code to be executed if condition is true }
if (condition)
{ code to be executed if condition is true }
else
{ code to be executed if first condition is not true }
if (first_condition)
{ code to be executed if condition is true }
else if (second_condition)
{ code to be executed if first condition is not true and this conditon is true}else
{ code to be executed if 1st & 2nd condition is not true }
switch(n) {
case 1:
execute code block 1
break
case 2:
execute code block 2
break
default:
code to be executed if n is different from case 1 and 2
}
Flow Charts help you define your logic!
Terms you need to Lookup:
Flow Charts, Conditional Statements, if else, switch, Function, Operators and Argument
Review the following:
| Operator | Description | Example |
|---|---|---|
| && | and | x=9 y=4 (x < 10 && y > 1) returns true |
| || | or | x=6 y=3 (x==5 || y==5) returns false |
| ! | not | x=10 y=5 !(x==y) returns true |
Homework:
Read Chapter 3Reminder: Post on the Discussion Board Section at least one URL of a Web Page that uses a Web script and describe how the script works.
Final Step:
Imagine that your mind is a DVD recorder / player and you can review this content anytime you want. I want you to close your eyes and quickly review in your mind everything we covered in class.
I also want you to review everything we covered before you go to bed because I want your mind to process this information while you sleep. You don’t need to spend much time on this review, 5 minutes will be enough!