Table of Contents
Learn to Program with JavaScript

CHAPTER 1---WHERE DO I BEGIN?
WHERE DO WE BEGIN
Programming the Easy Way
PLANNING A PROGRAM IS LIKE PLANNING A HOUSE
WE RECEIVE A CALL FROM OUR 'CLIENT'
WE MEET WITH OUR CLIENT
THE SYSTEMS DEVELOPMENT LIFE CYCLE (SDLC)
PHASE 1: THE PRELIMINARY INVESTIGATION
PHASE 2: ANALYSIS PHASE
PHASE 3: DESIGN PHASE
Output Design
Input Design
Processing Design
PHASE 4: DEVELOPMENT PHASE
PHASE 5: IMPLEMENTATION PHASE
PHASE 6: AUDIT AND MAINTENANCE PHASE
WHERE TO FROM HERE?
SUMMARY

CHAPTER 2--- GETTING COMFORTABLE WITH JAVASCRIPT
GETTING COMFORTABLE WITH JAVASCRIPT
WRITING OUR FIRST JAVASCRIPT PROGRAM
Create the Source File with a file name extension of .htm
ELEMENTS OF A JAVASCRIPT PROGRAM
The HTML Tag
The Head and Title Tags
The Body Tag
The Script Tag
HTML and JavaScript Comments
SUMMARY

CHAPTER 3---DATA
COMPUTER DATA
VARIABLES
Our first variable
Declaring a variable
Assigning a value to a variable
Declaration and Assignment combined
Variable Scope and Lifetime
CONSTANTS--SORRY, NOT IN JAVASCRIPT YET:(
JAVASCRIPT DATA TYPES
NUMERIC DATA TYPES
THE STRING DATA TYPE
THE BOOLEAN DATA TYPE
OPERATIONS ON DATA
ARITHMETIC OPERATIONS
The Addition Operator (+)
The Subtraction Operator (-)
The Multiplication Operator (*)
The Division Operator (/)
The Modulus Operator (%)
The Increment Operator (++)
The Decrement Operator (--)
Order of Operations
COMPARISON OPERATORS
LOGICAL OPERATORS
The And Operator (&&)
The Or Operator (||)
The Not Operator (!)
SUMMARY

CHAPTER 4---SELECTION STRUCTURES
SELECTION STRUCTURES
THE SEQUENCE STRUCTURE---FALLING ROCK
THE JAVASCRIPT SELECTION STRUCTURE---THE IF STATEMENT
JAVASCRIPT POPUP BOXES
The Alert Popup Box
The Prompt Popup Box
THE IF…ELSE STATEMENT
THE SWITCH STATEMENT
CONTINUING WITH THE GRADES CALCULATION PROJECT
SUMMARY

CHAPTER 5---LOOPS
WHY LOOPS?
THE FOR LOOP
Variations on the For Loop Theme
WHILE LOOPS
The While Loop
Do-While Loop
ADDING A LOOP TO THE GRADES CALCULATION PROJECT
SUMMARY

CHAPTER 6---CREATING YOUR OWN FUNCTIONS
MODULAR PROGRAMS ARE EASIER TO MAINTAIN AND UNDERSTAND
WHAT IS A FUNCTION?
CREATING YOUR OWN FUNCTIONS…
Function Parameters and Arguments
In JavaScript, Arguments are passed by Value
The Return Type
USING FUNCTIONS TO FINE TUNE YOUR CODE
SUMMARY

CHAPTER 7---CREATING YOUR OWN OBJECTS IN JAVASCRIPT
CALLING FUNCTIONS FROM EXTERNAL FILES
CREATING OBJECTS FROM INSTANTIABLE CLASSES
CREATING CLASSES IS AN EXTENSION OF MODULAR PROGRAMMING
Objects possess data (Properties) that simulate object characteristics
Objects have behavior
CONSTRUCTORS
CREATING OBJECTS FROM YOUR CLASSES
Changing an Object's Attributes
Calling an Object's Methods
CREATING MULTIPLE OBJECTS FROM YOUR CLASSES
CONSTRUCTORS WITH ARGUMENTS
CLASS VARIABLES
SUMMARY

CHAPTER 8---CONTROLLING ACCESS TO THE DATA IN YOUR OBJECT
CONTROLLING ACCESS TO YOUR OBJECT'S DATA
INSTANCE VARIABLES--PUBLIC OR PRIVATE?
USING SET AND GET STATEMENTS
Mutator Methods
Accessor Methods
Let's analyze the Grades Calculation project for Data Integrity
A surprise visit from Frank Olley
SUMMARY

CHAPTER 9---ARRAYS
WHY ARRAYS
WHAT'S AN ARRAY?
DECLARING AND INITIALIZING AN ARRAY
ADDING DATA TO THE ELEMENTS OF AN ARRAY
THE WONDERS OF ARRAY PROCESSING
USING AN ARRAY FOR AVERAGING
A PROBLEM WITH OUR ARRAY
MULTIPLE DIMENSIONED ARRAYS
CREATING ARRAYS OF OBJECTS
SUMMARY

CHAPTER 10---EXCEPTION HANDLING
COMMON BEGINNER ERRORS
LOAD-TIME ERRORS--WHEN NOTHING SEEMS TO HAPPEN
Misspelling Object Names
Braces (and parentheses) must occur in matching pairs
RUNTIME ERRORS
JavaScript is Case sensitive
Forgetting the left and right parentheses for the condition in an If structure generates a Runtime error. Parentheses are required.
LOGIC ERRORS
Referring to an Array element that doesn't exist
Forgetting to Increment a Counter Variable
Forgetting to Add to an Accumulator
Not providing a way for a while structure to end
Forgetting to code a break statement when one is needed in a switch structure can cause unpredictable results
Confusing the equality operator (==) with the assignment operator (=) generates Nothing
Forgetting to specify the return value for a function you write doesn't produce an error but...
JAVASCRIPT ERROR HANDLING
JAVASCRIPT EXCEPTIONS
Ignore the Exception
Handle the Exception with Try-Catch-Finally blocks
CAN WE MODIFY THE GRADES CALCULATION PROJECT?
SUMMARY

CHAPTER 11---DEVELOPING A GRAPHICAL USER INTERFACE
BUILDING A GRAPHICAL USER INTERFACE
DESIGNING OUR GUI
CREATING OUR GUI
Setting Up the Top-Level Component--the Form
Adding HTML Components to the Form
Create the GUI for the Grades Calculation Project
SUMMARY

CHAPTER 12---EVENT HANDLING IN JAVASCRIPT
JAVASCRIPT EVENT HANDLING
WHAT'S AN EVENT?
WHAT'S AN EVENT PROCEDURE?
IMPLEMENTING EVENT PROCEDURES IN YOUR CODE
Our First Event Procedure
PASSING YOUR EVENT PROCEDURE A REFERENCE TO YOUR GUI OBJECT
IMPLEMENTING EVENT PROCEDURES IN THE GRADES CALCULATION PROJECT
TESTING THE PROGRAM
DELIVERING AND IMPLEMENTING THE GRADES CALCULATION PROJECT IN THE ENGLISH DEPARTMENT
SUMMARY