Expressions and statementsUnit 5 |
|
Operators |
|
Look at the samples 5-1-operators. It shows the JavaScript operation, and the resulting value.
You can copy sample5-1.operators.html and sample5-1.operators.js |
|
Functions |
|
Look at the samples 5-2-functions. It shows the JavaScript functions, and function invocation. The contents of sample-5-2-functions.js are: sayHello(); saySomething("What's up Doc?"); saySomething(); function sayHello() { alert("hello"); } function saySomething(it) { // use an empty string if it is undefined var aString = it == undefined ? "" : it ; alert("The word is: " + aString); } Notice the use of the ternary operator to change undefined to "". |
|
Lab 2 |
|
In lab 2 you will build one more page. |
|
Put your web page on the Internet |
|
Put your page on the Internet. |
|
Test your page |
|
Validate your page before trying to get the JavaScript to work. Then make sure the JavaScript works. |
|
Complete lab 2 |
|
You have done all the work for lab 2. |
|
Reading assignment |
|
Reading assignments are in the text book, Java Script, A Beginner's Guide, Second Edition, by John Pollock; McGraw Hill / Osborne, ISBN 0-07-222790-7 Read Module 5.
The book does not discuss strings until later.
You should know these two string operators: "Hello" + " " + "there" This evaluates to: "Hello there"
The x = "hello"; y = "there"; x += y; This evaluates to: "hellothere"
Sections 5.1, 5.2, and 5.3 show operators that are similar to other programming languages.
Skim this material, and look at anything that looks unfamiliar. Alternate reading assignments are in the text book, Java Script Concepts & Techniques Programming Interactive Web Sites, by Tina Spain McDuffie; Franklin, Beedle & Associates, ISBN 1-887902-45-7 Read Chapter 4. |
|
Lecture notes |
|
Do NOT read the lecture notes before hearing the lecture. If you do, you will find the lecture very boring. Read the lecture notes if you do not attend the lecture, or if you wish to review the material. |
|