//constructor declarationfunction CustomObject() {};//using constructor to create an objectvar myObj = new CustomObject();myObj instanceof CustomObject;// > true
//declare constructor functionfunction MyObject() { }//create object with constructorvar myObj = new MyObject();
//constructor declaration with constructor argumentsfunction MyObject(dataObj) {this.data = dataObj;}//use the arguments like this:var myObj = new MyObject({items : 4});console.log(myObj.data.items);// > 4
function MyObject() {return {items : 3,count : function(num) {console.log(num);}}}