How to Create an Object in JavaScript
***If this post helped you, please support this blog by clicking one of the links on this page. Thanks :) ***
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);
I found this method to be easier
var o = {};
o.prop = 'val';
and for arrays var a = [];