1 | Here's another example: function Car( make, model ) { this.make = make || ""; this.model = model || ""; this.color = null; this.setColor = new Function( "color", "this.color = color" ); } |
2 | Instantiate a Car object with new: myCar = new Car( "Ford", "Explorer" ); myCar.setColor( "red" ); |