To create a variable called myVariable, you need to place a declaration like this in the script source text:
You can optionally assign an initial value to the variable as it is declared. Like this:
var myVariable = "Initial value";
The semantics of the ECMAScript standard dictate that variable declarations must follow Function Declarations and Formal Parameter List processing.
The initial value of variables as they are declared is set to undefined. Any attributes of the property in the variable object are defined by the type of code. If a variable already exists and a declaration duplicates the same identifying name, the present value will not be replaced by the undefined value. In particular, a variable declaration cannot replace a previously declared function definition or formal parameter name.
ECMA 262 edition 2 - section - 10.1.3
ECMA 262 edition 3 - section - 10.1.3