For this Question: You will be given a <code>list of employees</code> with their information in a <code>JSON format as an argument</code>. Your task is to implement a JavaScript function, <code>performEmployeeOperations</code>, that performs the following tasks:

<ol>
<li>Find the <code>employee with the highest salary</code> and store it in the <code>highestSalaryEmployee</code>. Note, the <code>highestSalaryEmployee</code> logic has already been provided in the boilerplate. For the rest of the operations, you might have to look into array loop methods, like reduce, filter, map, etc.</li>

<li>The <code>employeesByDepartment</code> returns an <code>object</code> of employees grouped by department. The <code>department should be the key</code> and an <code>array of employees with their information as value</code>.</li>

<li>The <code>averageAgeByDepartment</code> returns an <code>object</code>, with the <code>department as key</code> and the <code>average age of that department as value</code>.</li>

<li><code>employeesWithLongestName</code> returns an <code>array</code> with the <code>employee(s) information having the longest name(s)</code>.</li>

</ol>

<code>Note:</code>
**Remove the extra spaces from the list while inserting the list of employees in the input section.**The <code>performEmployeeOperations</code> function will take in an <code>array of objects in JSON format</code>. Each Object will have a <code>name</code>, <code>age</code>, <code>department</code>, and <code>salary</code> property.The <code>performEmployeeOperations</code> function should return an <code>object</code> of <code>highestSalaryEmployee</code>, <code>employeesByDepartment</code>, <code>averageAgeByDepartment</code>, <code>employeesWithLongestName</code>.

<code>highestSalaryEmployee</code> should store the <code>object of the employee having the highest salary</code>.

<code>employeesByDepartment</code> should return an <code>object</code>.

<code>averageAgeByDepartment</code> should return an <code>object</code>.

<code>employeesWithLongestName</code> should return an <code>array of object</code>.const employees = [{"name":"John","age":30,"department":"HR","salary":50000},{"name":"Jane","age":28,"department":"IT","salary":60000},{"name":"Mark","age":35,"department":"HR","salary":55000},{"name":"Alice","age":32,"department":"Finance","salary":65000},{"name":"Charlie","age":40,"department":"IT","salary":70000}]

const operations = performEmployeeOperations(employees);

console.log(operations.highestSalaryEmployee); // Output: { name: 'Charlie', age: 40, department: 'IT', salary: 70000 }

console.log(operations.employeesByDepartment);  
// Output:  
 {
  HR: [
    { name: 'John', age: 30, department: 'HR', salary: 50000 },
    { name: 'Mark', age: 35, department: 'HR', salary: 55000 }
  ],
  IT: [
    { name: 'Jane', age: 28, department: 'IT', salary: 60000 },
    { name: 'Charlie', age: 40, department: 'IT', salary: 70000 }
  ],
  Finance: [ { name: 'Alice', age: 32, department: 'Finance', salary: 65000 } ]
}

console.log(operations.averageAgeByDepartment); //Output:  { HR: 32.5, IT: 34, Finance: 32 }

console.log(operations.employeesWithLongestName); //Output:  [ { name: 'Charlie', age: 40, department: 'IT', salary: 70000 } ], I have written this Solution Code: function performEmployeeOperations(employees) {

  const highestSalaryEmployee = employees.reduce((acc, emp) => emp.salary > acc.salary ? emp : acc, employees[0]);

  const employeesByDepartment = employees.reduce((acc, emp) => {
    if (!acc[emp.department]) {
      acc[emp.department] = [];
    }
    acc[emp.department].push(emp);
    return acc;
  }, {});

  const averageAgeByDepartment = Object.keys(employeesByDepartment).reduce((acc, department) => {
    const employeesInDepartment = employeesByDepartment[department];
    const totalAge = employeesInDepartment.reduce((sum, emp) => sum + emp.age, 0);
    const averageAge = totalAge / employeesInDepartment.length;
    acc[department] = averageAge;
    return acc;
  }, {});

  const longestNameLength = Math.max(...employees.map(emp => emp.name.length));
  const employeesWithLongestName = employees.filter(emp => emp.name.length === longestNameLength);

  return {
    highestSalaryEmployee,
    employeesByDepartment,
    averageAgeByDepartment,
    employeesWithLongestName
  };
}, In this Programming Language: JavaScript, Now tell me if this Code is compilable or not?