Arbitrary objects are defined with the function statement: function car(make, model) { this.make = make; this.model = model; this.color = null; this.setColor = new Function("color", "this.color = color"); } |
Instantiate an object with new: myCar = new Car("Ford", "Explorer"); myCar.setColor("red"); |