For this Question: Create a constructor function named <code>Factory</code> that creates an object . This object should have a method named <code>createEmployee</code> which takes three arguments first name,last name and type of employee . There can be three types of employees  <code>"fulltime"</code>, <code>"parttime"</code>, <code>"intern"</code>. 

If the type of employee is "fulltime" return an object whose contructor function is named <code>"Fulltime"</code>  which  takes in three arguments <code>firstName</code>, <code>lastName </code>and the string <code>"fulltime"</code> (type of employee) .

If the type of employee is "parttime" return an object whose contructor function is named <code>"PartTime"</code>  which  takes in three arguments <code>firstName</code>, <code>lastName</code> and the string <code>"partTime"</code> (type of employee).

If the type of employee is "intern" return an object whose contructor function is named <code>"Intern"</code>  which  takes in three arguments <code>firstName</code>, <code>lastName</code> and the string <code>"intern"</code> (type of employee).


The constructor functions <code>"FullTime"</code>, <code>"PartTime"</code>,<code>"Intern"</code> should have properties <code>firstName,lastName,type</code> which are passed as the arguments to its constructor function. These three constructor functions should also have a private variable named salary which should be initialized with 0. 

The constructor function of "FullTime" should have a property named "level" which should have value 3.
The constructor function of "PartTime" should have a property named "level" which should have value 2.
The constructor function of "Intern" should have a property named "level" which should have value 1


These three constructor functions should also contain two functions named <code>"getSalary"</code> which returns the salary of the employee and <code>"setSalary"</code> which sets the salary of the employee and does not return anything.There is no input in this questionthere is no output in this question.

The list of constructor functions that you will have to make :

<ol>
<li> Factory 
<li> FullTime
<li> PartTime
<li> Intern
</ol>

<b><code>FullTime</code>,<code>PartTime</code>,<code>Intern</code> constructor functions should take in three arguments <code>firstName</code>,<code>lastName</code> and <code>type</code> and the function named <code>Factory</code> does not take in any argument. </b>let factory = new Factory();
let emp = factory.createEmployee("Kunal", "Singh", "intern");


console.log(emp.salary);    // undefined
console.log(emp.getSalary()); // 0
console.log(emp.firstName); // Kunal
console.log(emp.lastName); // Singh
console.log(emp.setSalary(1000)); // undefined
console.log(emp.getSalary());  // 1000
console.log(emp.level); // 1, I have written this Solution Code: const Factory = function () {
    this.createEmployee = function (firstName, lastName, type) {
        var employee;

        if (type === "fulltime") {
            employee = new FullTime(firstName, lastName, "fulltime");
        } else if (type === "parttime") {
            employee = new PartTime(firstName, lastName, "parttime");
        } else if (type === "intern") {
            employee = new Intern(firstName, lastName, "intern");
        }
        return employee;
    };
};

function FullTime(firstName, lastName, type) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.type = type;
    let salary = 0;
    this.level=3
    this.getSalary = function () {
        return salary;
    };

    this.setSalary = function (amount) {
        salary = amount;
    };
}

function PartTime(firstName, lastName, type) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.type = type;
    let salary = 0;
    this.level=2
    this.getSalary = function () {
        return salary;
    };

    this.setSalary = function (amount) {
        salary = amount;
    };
}

function Intern(firstName, lastName, type) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.type = type;
    let salary = 0;
    this.level=1;

    this.getSalary = function () {
        return salary;
    };

    this.setSalary = function (amount) {
        salary = amount;
    };
}, In this Programming Language: JavaScript, Now tell me if this Code is compilable or not?