Wednesday, February 13, 2008

JavaScript Tutorials

JavaScript Tutorials

http://www.herongyang.com/JavaScript

This free book is a collection of tutorial examples and notes written by the author while he was learning JavaScript. Topics include data type, variable, expression, statement, loop, user function, object, property, method, array.

Table of Contents

About This JavaScript Tutorial Example Book

Introduction to JavaScript

What Is JavaScript?

First JavaScript - "Hello World!"

Walking through the First JavaScript

The document.write() Method

Data Types, Variables and Expressions

Primitive Data Types - Numbers, Strings, and Booleans

Numeric Value Literals

String Literials

Declaring Variables - "var" Statements

Operators and Expressions

Operators and Expressions - Examples

Flow Control Statements

What Is a Statement?

Conditional "if" Statements

Conditional "if" Statement Examples

"switch ... case" Statements

"switch ... case" Statement Example

"for" Loop Statements

"for" Loop Statement Example

"while" Loop Statements

"while" Loop Statement Example

Creating, Accessing, and Manipulating Arrays

What Is an Array?

Creating an Array Object

Accessing Array Elements with Indexes

Truncating and Iterating Array Elements

Array Object Instance Methods

Array Object Instance Method Examples

Defining and Calling Functions

Defining Your Own Functions

Defining Your Own Functions - Example

Calling Your Own Functions - Example

Passing Parameters by Value or by Reference

Function Parameters Are Passed as Local Copies

Function Parameters Are Passed as Local Copies - Example

Global and Local Variables - Scope Rules

Global Variables - Examples

Local Variables - Examples

Collision of Global and Local Variables - Examples

"return" Statement and Return Value

Web Browser Supporting JavaScript

JavaScript Support Introduction

Including JavaScript Codes with HTML "script" Tags

Including JavaScript Codes as External Files

DOM API - The "document" Object

DOM API - The "window" Object

Event Listeners and Objects

Introduction to Objects

What Is an Object?

Objects of "Object" Data Type

Adding and Deleting Object Own Properties

Adding and Deleting Object Own Methods

Using "this" Keyword to Represent Current Object

Object Literals of the "Object" Type

Objects and Associate Arrays

Objects with Indexed Properties

Differences between "Object" and "Array"

Using "Array" Objects as "Object" Objects

Defining Your Own Object Types

Prototype-Dased Object-Oriented Programming Style

Prototype-Based Programming Features in JavaScript

Defining Object Constructor Functions

Adding Properties and Methods to Objects

"for ... in" and "for each ... in" Statements

"prototype" Property of the Constructor Function Object

"instanceof" Operator - Determining Object Type

"typeof" Operator and Data Types

Inheritance of Properties and Methods through the Prototype Object Chain

Inheriting from Constructor's Prototype Object

Changing the Constructor's Prototype Object

Inheriting Properties from Two Level Prototype Objects

Built-in Properties and Methods in "Object.prototype"

Using "hasOwnProperty()" Method to Test Inherited Properties

Setting the "constructor" Property in the "prototype" Object

Adding Local Methods at the Object Level

Adding Inherited Methods at the Prototype Level

Building Multiple Levels of Prototype Objects

Prototype Object Chain Summary

References

PDF Printing Version

Labels: ,