JavaScript数据类型
字符串(String)、数字(Number)、布尔(Boolean)、数组(Array)、对象(Object)、空(Null)、未定义(Undefined)
定义数组:
var cars=new Array("Saab","Volvo","BMW");
或:
var cars=new Array();
cars[0]="Saab";
cars[1]="Volvo";
cars[2]="BMW";
或:
var cars=["Saab","Volvo","BMW"];
定义对象:
var person={firstname:"John", lastname:"Doe", id:5566};
对象属性有两种寻址方式:
name=person.lastname;
name=person["lastname"];