$(function () { //1.声明一个空数组 var data = [];
一、一次性赋值
//2.初始化 var e = new GouZaoHanShu(); //3.赋值e会拥有GouZaoHanShu方法内所有的成员 e.new1 = "1"; e.new2 = "2"; e.new3 = "3"; e.new4 = "4"; //4.添加到数组中 data.push(e);
二、多次赋值
for (var i = 0; i < length; i++) {
//2.初始化 var e = new GouZaoHanShu(); //3.赋值e会拥有GouZaoHanShu方法内所有的成员 e.new1 = "1"; e.new2 = "2"; e.new3 = "3"; e.new4 = "4"; //4.添加到数组中 data.push(e);
} //5.把数据运用到你想要的地方
//输出结果
console.log(data)
}) //构造函数结构 function GouZaoHanShu() { this.new1; this.new2; this.new3; this.new4;//要多少成员写多少 }