Interview GURU

How to create objects in JavaScript?

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.

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