How to define Objects in JavaScript
We can use constructors described later but simplest way is:
newobject ={};
newobject.car = “honda”;
newobject.wheels = 4;
newobject.color = “red”;
Or newobject={car:”honda”,wheels:4,color:”red”};
Or newobject = new Array();
newobject[“car”] = “honda”; // etc.
This allows an “associative array”
Previous slide
Next slide
Back to first slide
View graphic version