Objects

Create Object using Constructor in JavaScript

Used to create a new object using a constructor.


Syntax
var newObject = new Object(); //default object constructor
newObject.key = value; //setting value pair for an object

Notes

To create an object using a pre-defined prototype (using a custom constructor), see the Constructor page.


Example
var vehicle = new Object();
vehicle.type = "car";

See Also
Related

Constructor

Documentation

Working with objects - JavaScript | MDN

Add to Slack

< Methods   |   Constructor >

© 2018 SyntaxDB. All Rights Reserved.