CopyCode The Code is as follows: // The automobile factory in 1960s
VaR ocar = new object;
Ocar. color = "black ";
Ocar. Doors = 2;
Ocar. pinpai = "Liberation ";
Ocar. showpinpai = function ()
{
Alert (this. pinpai); // a production line is required to generate an automobile and create a new production line for the next automobile.
}
// Automobile factory in 1970s
Function createcar ()
{
VaR otempcar = new object;
Otempcar. color = "black ";
Otempcar. Doors = 4;
Otempcar. pinpai = "santana ";
Otempcar. showpinpai = function ()
{
Alert (this. pinpai); // convenient production. One production line can produce multiple vehicles.
}
Return otempcar;
}
// Automobile production in 1980s
Function createcar (scolor, idoors, spinpai)
{
VaR otempcar = new object;
Otempcar. Color = scolor;
Otempcar. Doors = idoors;
Otempcar. pinpai = spinpai;
Otempcar. showpinpai = function ()
{
Alert (this. pinpai); // convenient production and one-time molding
}
Return otempcar;
}
// Automobile production in 1990s
Function showpinpai ()
{
Alert (this. Color );
}
function createcar (scolor, idoors, spinpai)
{< br> var otempcar = new object;
otempcar. color = scolor;
otempcar. doors = idoors;
otempcar. pinpai = spinpai;
otempcar. showpinpai = function ()
return otempcar;
}< br> var obmw = createcar ("black", 4, "BMW");
obmw. showcolor (); // One-time molding + assembly and production