Share via


var Statement (JScript 5.6) 

Declares a variable.


var variable1 [ = value1 ] [, variable2 [ = value2], ...] 

Arguments

  • variable1, variable2
    The names of the variables being declared.
  • value1, value2
    The initial value assigned to the variable.

Remarks

Use the var statement to declare variables. These variables can be assigned values at declaration or later in your script.

Example

The following example illustrates the use of the var statement.


      var index;

var name = "Thomas Jefferson";

var answer = 42, counter, numpages = 10;

Requirements

Version 1

See Also

Reference

function Statement (JScript 5.6)
new Operator (JScript 5.6)