-using {}
-using new Object()
-using Object.create()
-using Object.assign()
-using ES6 Class
Object Creation Using ES6 Class:
class Employee{
constructor(name,dept){
this.name = name;
this.dept = dept;
}
}
const firstEmployee = new Employee('Pavan','IT');
console.log(firstEmployee);
Output //
{
name: 'Pavan',
dept: 'IT'
}
Top comments (1)
I am just creating contents for my reference, will try to add more detailed description