JavaScript Tutorials - Herong's Tutorial Examples - 2.33, by Herong Yang
JavaScript Tutorials - Herong's Tutorial Examples
https://www.herongyang.com/JavaScript
Copyright © 2002-2023 Herong Yang. All rights reserved.
This book is a collection of tutorial examples and notes written by the author while he was learning JavaScript. Topics include ECMAScript specifications; data types, variables and expressions; flow control statements: 'if', 'for', 'switch', and 'while'; using arrays and objects; defining and calling functions; embedding JavaScript code in HTML documents; DOM (Document Object Model) API levels; using the JavaScript console in Web browsers; creating new object types with prototypes; building prototype inheritance hierarchy; managing functions as objects; using jrunscript JavaScript shell; sending AJAX (XMLHttpRequest) requests. Updated in 2023 (Version 2.33) with AJAX tutorials.
Table of Contents
First JavaScript - "Hello World!"
Walking through the First JavaScript
ECMAScript Language Specification and JavaScript Dialects
JavaScript History and Versions
ECMAScript Language Specification
Automatic Semicolon Insertion to End Statements
Data Types, Variables and Expressions
Primitive Data Types - Numbers, Strings, and Booleans
Declaring Variables - "var" Statements
Operators and Expressions - Examples
Conditional "if" Statement Examples
"switch ... case" Statement Example
"while" Loop Statement Example
Creating, Accessing, and Manipulating Arrays
Accessing Array Elements with Indexes
Truncating and Iterating Array Elements
Array Object Instance Method Examples
Defining and Calling 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
Collision of Global and Local Variables - Examples
"return" Statement and Return Value
Web Browser Supporting JavaScript
JavaScript Support in Web Browsers
Including JavaScript Codes with HTML "script" Tags
type="text/javascript" or language="JavaScript"
JavaScript Version Supported by Browsers
Including 'script' Tags in String Literals
Escaping 'script' Tags in String Literals
Using HTML Entities to Protect HTML Tags
Including JavaScript Codes as External Files
DOM API - The "document" Object
DOM API - The "window.open" Method
'javascript:' Pseudo-URL Addresses
JavaScript Console in Google Chrome
JavaScript Console in Mozilla Firefox
JavaScript Console in Apple Safari
JavaScript Console in IE (Internet Explorer)
Server-Side and Client-Side Web Scripting
Web Scripting Architecture Overview
Server-Side Scripting Overview
Client-Side Scripts for Document Updating
Client-Side Scripts for Event Handling
Client-Side Scripting Processed Multiple Times
New Script Resulted from Two Original Scripts
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 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
'jrunscript' - JavaScript Shell Command from JDK
Downloading and Installing JDK 10
"jrunscript" - Scripting Shell Command and Options
Running JavaScript Code with 'jrunscript'
Evaluating JavaScript Code with 'jrunscript' Interactively
Running a JavaScript Code File with 'jrunscript'
Using Functions as "Function" Objects
Introduction to Built-in Object Types
Overview of Built-in Object Types
The "Object" Object Type - The Root Object Type
The "Global" Object Type - The Invisible Global Container
Global Properties and Functions Defined in ECMAScript
Global Properties and Functions Provided by "jrunscript"
The "Function" Object Type - Functions Are Objects
The "Array" Object Type - Arrays Are Objects
The "JSON" Object Type - parse() and stringify()
The "String" Object Type - Not Equal to String Primitive Type
The "Boolean" Object Type - Wrapping Boolean Values into Objects
The "Number" Object Type - Not Equal to Number Primitive Type
The "Date" Object Type - Managing Dates and Times
The "RegExp" Object Type - Regular Expression Patterns
The "Error" Object Type - Runtime Exceptions
The "Math" Object Type - The Math Container
W3C's Document Object Model (DOM) Specifications
Keywords: JavaScript, Web, DOM, JSON