An object can easily be created in JavaScript by creating a new instance of the native JavaScript Object class. Following this, properties can be assigned to it, as follows:
var objCar = new Object();
objCar.wheels = 4;
document.write(objCar.wheels);
Filed under: JavaScript, programming, software |
I found this method to be easier
var o = {};
o.prop = 'val';
and for arrays var a = [];