All variables must be initialized before being read or modified. In JavaScript, variables have only a few possible types, and there is only very weak type checking when you use an assignment statement. No distinction is made between these subtypes for most purposes. In JavaScript 3.0, strings have been promoted to be objects, which makes the syntax govering their use more regular than it was in JavaScript 2.0. Strings can be initialized to any sequence of characters, including the empty string.
Objects can have methods which are special functions which belong to the variable.
Typically these are used to read or modify the internal components of the object. All windows, frames and forms are objects. There is a special object whose name is null , and you should initialize object variables to null before you use them in functions. It is not necessary to do this for local variables because the garbage collector recognizes when an object goes out of scope. There is a distinction between the arrays which are available in JavaScript 1.0 and those which are available in JavaScript 1.1.