Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Statements
STATEMENT: var
var
The
var
statement is used to declare a variable, and outside of a function its use is optional. While a variable can be declared simply by assigning it a value, it is good practice to use
var
as there are two cases in functions where it is necessary:
If a global variable of the same name exists.
If recursive or multiple functions use variables of the same name.
Code:
var i;
You can also declare more than one variable and, optionally, assign values at the same time:
Code:
var i = 0, x, max = 57;
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information