创建对象:
1、people = new Object();
people.name = "lin";
people.age = "26“;
2、创建字典对象
people = {name:"lin",age:"30"};
3、通过set方法创建对象
function people(name,age){
this._name = name;
this._age = age;
}
son = people("lin",26);
document.write("name:"+son.name +"age:"+son.age);
时间: 2024-11-07 06:05:08