in JavaScript by
Q:
How to create objects in JavaScript?

1 Answer

0 votes
by

There are 3 ways to create an object in JavaScript.

  1. By object literal
  2. By creating an instance of Object
  3. By Object Constructor

Let's see a simple code to create an object using object literal.

  1. emp={id:102,name:"Rahul Kumar",salary:50000}   

Related questions and answers

0 votes
asked Jun 9 in JavaScript by sharadyadav1986
+1 vote
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Sep 18, 2021 in JavaScript by sharadyadav1986
...