28.getHighestPaidEmployee

Write a function named getHighestPaidEmployee that receives 2 parameters:

  • employees - an Array of objects representing employees of a company. Each has the following properties

    • name - a string representing the name of the employee
    • departmentId - a string representing the ID of the department the employee works in
    • salary - a number representing the salary of the employee, per month
  • departmentId - a string representing the ID of a department

The function should return the name of the employee with the highest salary in the specified department. If no employee exists in that department return undefined.

Example 1

Input

employees

=

departmentId

=

Output