English, asked by sonikumarimohit, 11 months ago

how do you create a new object in java script? ​

Answers

Answered by Anonymous
3

Answer:

Explanation:

Different ways of creating an Object in javascript

Using the Object() constructor: var d = new Object(); ...

Using Object.create() method: var a = Object.create(null); ...

Using the bracket's syntactig sugar: var b = {}; ...

Using a function constructor. var Obj = function(name) { this. ...

Using the function constructor + prototype: ...

Using ES6 class syntax: ...

Singleton pattern:

Answered by hanpriya
0

syntax:

<classname><objectname>=new<objectname>();

Similar questions