For this Question: You are given a class <code>Person</code>. Complete its <code>constructor</code> and function <code>greet</code>. The <code>constructor</code> should create a variable called <code>name</code> and the <code>greet</code> function should print in the console <code>"Hello, my name is {name}"</code>. Use the <code>this</code> keyword to refer to the <code>name</code> variable inside the <code>greet</code> function.

You are also given a class <code>Student</code> which is a subclass of <code>Person</code>. You have to complete its <code>constructor</code> which initializes the variable of <code>Student</code> class <code>major</code> and the <code>name</code> variable of the parent class <code>Person</code>. Also, complete the <code>study</code> function which should print in the console <code>"{name} is currently studying {major}"</code>. Use the <code>this</code> keyword to refer to the <code>name</code> and <code>major</code> variables inside the <code>study</code> function.Input will have 3 strings, viz. name1, name2 and major, separated by commas.

You need not worry about the same, it is handled properly by the hidden pre-function code.

Example:
John,Sarah,Computer ScienceThe <code>greet</code> function should print in the console <code>"Hello, my name is {name}"</code>.

The <code>study</code> function which should print in the console <code>"{name} is currently studying {major}"</code> const person1 = new Person("John");
 person1.greet(); // should log "Hello, my name is John"
    
const student1 = new Student("Sarah", "Computer Science");
student1.greet(); // should log "Hello, my name is Sarah"
student1.study(); // should log "Sarah is currently studying Computer Science", I have written this Solution Code: class Person {
    constructor(name) {
        this.name = name;
    }
    greet() {
        console.log(`Hello, my name is ${this.name}`);
    }
}

class Student extends Person {
    constructor(name, major) {
        super(name);
        this.major = major;
    }
    study() {
        console.log(`${this.name} is currently studying ${this.major}`);
    }
}

function solve(name1, name2, major){
    const person1 = new Person(name1);
    person1.greet(); // should log "Hello, my name is {name1}"
    
    const student1 = new Student(name2, major);
    student1.greet(); // should log "Hello, my name is {name2}"
    student1.study(); // should log "{name2} is currently studying {major}"
}, In this Programming Language: JavaScript, Now tell me if this Code is compilable or not?