Creating Object in Javascript
Using Object literal
var obj = new Object();Using Function Constructor
var tom = new Avatar();Using
Object.createvar obj1 = Object.create(o)Object.createcreates a new object with its prototype object passed as a parameter (obj2 in above example).Using curly brackets syntax
var obj1 = {}; // This is equivalent to Object.create(null) method, it would set the created object's prototype =null .In ES6, we use class pattern
Last updated