What is an object constructor?
Object constructor is a constructor function of a built-in object called an object.
Object constructor is convenient to create a single object.
Creating a new object using object() constructor:
var objectName= new Object();
- Creates a new empty object
- Sets the value of implicit prototype “__proto__” of a new empty object to tits constructor prototype.
- Calls its constructor function with “newly created memory location address” with “list of arguments” if passed.
- Returns the reference of new object, if constructor function does not return anything explicitly.
var rect1= new Object();
In the above example code, we have created an object using an object constructor. First, we put the “var” keyword then give an object name called “ret1, and then put isequalto (=) operator to create a new object().