Explained below are some of the different ways of creating Objects in JavaScript.

  • Objects created with syntax constructs (Object Literal Notation)
var o = {a: 1};
  • With Function (New Objects with Constructor function)

A constructor is a function that contains instructions about the properties of an object when that object is created and assigned. Advantage over object literal is you can create many instances of objects that have the same properties.

function Car() {
    this.make = 'Honda';
    this.model = 'Civic';
}

var c = new Car();
  • With Object.create

ECMAScript 5 introduced a new method Object.create.

var a = {a: 1};

var b = Object.create(a);

console.log(b.a); // 1 (inherited)
  • With Class

JavaScript classes were introduced in ECAMScript 2015 (ES6)

Class Car {
    constructor(make, model) {
        this.make = make;
        this.model = model;
    }
}

var c = new Car();

Reference