function createCar(){
var car = new Object();
car.color="b";
car.length=1;
car.run = function(){
console.log("run");
}
return car;
}
var car1_1 = createCar();
car1_1.run();
var car2_2 = createCar();
function Student(name,age){
this.name = name;
this.age = age;
this.add = function(){
console.log(this.name + this.age);
}
}
var stu1 = new Student('Gao','77');
stu1.add();
function P_Car(){
}
P_Car.prototype.color="b";
P_Car.prototype.length=1;
P_Car.prototype.run=function(){
console.log("run");
};
P_Car.prototype.data1=new Array();
var pcar1=new P_Car();
var pcar2=new P_Car();
pcar1.data1.push("a");
function M_Car(){
this.color="b";
this.length=1;
this.data2 = new Array();
}
M_Car.prototype.run=function(){
console.log("dddd");
};
var m_car1 = new M_Car();
m_car1.data2.push(m_car1.color,m_car1.length);
console.log(m_car1.data2);
function auto_Car(){
this.color="b";
this.length=1;
this.data1 = new Array();
if(typeof auto_Car.initilize=="undefined"){
auto_Car.prototype.run = function(){
alert("adsa");
}
}
auto_Car.initilize=true;
}
var auto_car = new auto_Car();
auto_car.run();