Imagine you have an array structured like this:
employeeArr = ['Steve', '80000', 'Jen', '90000', 'Bob', '40000']
Where employeeArr[0]
and employeeArr[2]
represent employee names, and employeeArr[1]
and employeeArr[3]
represent their respective salaries.
How would you create a function that returns the name of the individual with the highest salary?
Based on the array provided, the function should return 'Jen'
since she has the highest salary.
One approach could be converting all values in the array to integers using parseInt()
, finding the maximum value, and then identifying the name of the employee associated with that salary. Struggling to come up with a working solution, any assistance would be greatly valued!