Create JavaScript Object Using ES 6 Class

ECMAScript 6 introduced the class keyword to create classes in JavaScript. 
Now you can use the class attribute to create a class in JavaScript instead of a function constructor, and use the new operator to create an instance.

Create JavaScript Object Using ES 6 Class 

Let's create an Employee class:
class Employee {
    constructor(firstName, lastName, emailId, age){
        this.firstName = firstName;
        this.lastName = lastName;
        this.emailId = emailId;
        this.age = age;

        return this.firstName + " " + this.lastName;

        return this.firstName;
Now, we create an object of Employee class and access its methods:
const employee = new Employee('Ramesh', 'Fadatare', '', 29);

Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course