JavaScript Wrap Up
JavaScript is a versatile programming language … if you know it, you can learn others

The Big Picture
Without JavaScript, HTML is quite limited
Only static page-layouts are possible
JS allows
Adaptivity … the page can be customized to the browser, site, user, etc.
Interactivity … users can give information and a response can be displayed: Memory Bank
Applications … tasks unrelated to documents can be created
Animations

Big Picture
Notice the standard HTML process
HTML is parsed -- read & “decoded”
During parse JavaScript runs … allowing it to generate HTML, e.g. document.write()
Browser generates the page from HTML
After page generated, all is quiet until an event happens, caused by user or timer
Event handlers handle the events, and then all is quiet again

Consider The PC
Analyze the process for Purple Con
HTML is parsed
JavaScript runs …
HTML generated
Browser makes page
All is quiet except for
events from user
Event handlers handle
events, quiet returns

Consider The PC
Analyze the process for an animation
HTML is parsed
JavaScript runs …
HTML generated
Browser makes page
All is quiet except for
events from timer
Event handlers handle
events, quiet returns

Other Languages
JS is a “modern” programming language like C, C++, Java, etc.
Expect to find numbers, strings, Booleans,
Variables (of same form) must be declared
There are if-statements & else-statements
There is a for-statement
for (j=0; j<5; j++){
<statement list>
}

Review & Tutorial
Can you create an animation?
Can you take in data and compute answers?
Got questions?

j As Variable & String
Consider ...

One More Application
Bubbles ...

Summary
JavaScript can build Web pages, process forms and animate … it’s a whole lot more interesting than HTML!