//Design a class for employee which takes id and name in during construction of object and has a salary property //Design a class which is manager and can have department property var Employee = function(id,name){ if(!id || !name){ throw new Error('Employee id and name are mandatory'); } this.id = id ; this.name = name ; } Employee.prototype.setSalary = function(salary){ this.salary = salary ; } Employee.prototype.getSalary = function(){ return this.salary; } Employee.prototype.getName = function(){ return this.name; } Employee.prototype.getId = function(){ return this.id; } var Manager= function(params){ Employee.apply(this,arguments); this.iamge = params.image ; } Manager.prototype = Object.create(Employee.prototype); Manager.prototype.constructor =Manager ; Manager.prototype.setDepartment= function(name){ this.deapartment = name ; } Manager.prototype.getDepartment= function(){ return this.deapartment; } const employee = new Employee(1,"Satya"); employee.setSalary(100); const manager = new Manager(2,'John'); manager.setDepartment('CS'); console.log(employee.getSalary()); console.log(manager);