Copy codeThe Code is as follows:
// 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)
{
Var oTempCar = new Object;
OTempCar. color = sColor;
OTempCar. doors = iDoors;
OTempCar. pinpai = sPinpai;
OTempCar. showPinpai = function ()
Return oTempCar;
}
Var oBmw = createcar ("black", 4, "BMW ");
OBmw. showColor (); // One-time molding + assembly production