第一种:new Object
function Demo(){
var obj=new Object();
obj.name="张思";
obj.age=12;
obj.firstF=function(){
}
obj.secondF=function(){
}
return obj;
}
var one=Demo();
// 调用输出
document.write(one.age);
第二种:构造函数
function Demo(){
this.name="张思";
this.age=12;
this.firstF=function(){
}
this.secondF=function(){
}
}
var one=new Demo
// 调用输出
document.write(one.age);