JavaScript Tutorials - Herong's Tutorial Examples - 2.33, by Herong Yang
What Is a Statement
This section provides a quick description of different types of statements and a tutorial example on how to write expression and other statements.
What is a statement? A statement is a basic execution unit in JavaScript. Several notes about JavaScript statements:
Here is a JavaScript tutorial example that shows you different types of statements:
<html> <!-- Statements.html Copyright (c) 2002 HerongYang.com. All Rights Reserved. --> <head><title>Statements</title></head> <body> <pre> <script type="text/javascript"> var x,y,z; // A "var" statement x=1, y=4, z=9; /* An expression statement with 3 comma operators and 3 assignment operators. The result this expression is 9.*/ x*x; y*y; z*z; // 3 statements in 1 line { // a statement block x *= x; y *= y; z *= z; } if (true) // A "if" statement document.write("7 statements in total."); </script> </pre> </body> </html>
Table of Contents
ECMAScript Language Specification and JavaScript Dialects
Data Types, Variables and Expressions
Conditional "if" Statement Examples
"switch ... case" Statement Example
"while" Loop Statement Example
Creating, Accessing, and Manipulating Arrays
Defining and Calling Functions
Web Browser Supporting JavaScript
Server-Side and Client-Side Web Scripting
Defining Your Own Object Types
Inheritance of Properties and Methods through the Prototype Object Chain
'jrunscript' - JavaScript Shell Command from JDK
Using Functions as "Function" Objects
Introduction to Built-in Object Types
W3C's Document Object Model (DOM) Specifications