JavaScript Examples and Exercises

Part I - Core JavaScript Features

Hello World

Datatypes and Literals

Variables and Assignments

Arithmetic Operators

The Math object

Boolean Expressions

Selection Statements

Iteration (loops) Statements

Arrays 1

Strings

Number

Date

Functions

Part II - Morning Breakout (CAL version 1)

Computer Aided Learning (CAL) Starter Version

CAL Q1

CAL Q2

CAL Q3

CAL Q4

CAL Q5

CAL Q6

CAL Q7

CAL Q8

CAL - full solution

Part III - Introduction to DOM and Event Handling

DOM Examples

DOM Initial Demos

DOM Example 1

DOM Example 2

DOM Example 3

DOM Example 4

DOM Example 5

Event Examples

Events Demo - Hello World!

Events Demo 1 - Date/Time

Events Demo 2 - Date/Times (at end of body)

Events Demo 2a - Date/Times (in div)

Events Demo 3 - Reading text

Events Demo 4 - Building a list

Events Demo 5 - Guess Game v1

Events Demo 5.1 - Improved Guess Game v1

Part IV - Afternoon Breakout

Guess Game - Task 1

Guess Game - Task 2

Guess Game - Task 3

Guess Game - Task 4

Online CAL version 1

Online CAL version 2

Part V - Odds and Ends

HTML Demos

Example 1 - unformatted text
Example 1 - formatted / marked up
Nice Page

Events/DOM

Arithmetic (add/subtract)

Silly Story Generator

Canvas

Canvas Demo V1 - sticks

Canvas Demo V2 - shapes

Code scatchpad

A general scratchpad