Top salary
EasyObjects5 min
Write a function topSalary(salaries). In the object salaries each key is a name and each value is a salary.
Return the name of the person with the highest salary. If the object is empty, return null.
Examples
topSalary({ John: 100, Pete: 300, Mary: 250 })Returns 'Pete'
topSalary({})Returns null
topSalary({ Ann: 0 })Returns 'Ann'
Loading the editor...
- Input
topSalary({ John: 100, Pete: 300, Mary: 250 })Expected'Pete' - Input
topSalary({})Expectednull - Input
topSalary({ Ann: 0 })Expected'Ann'
Hidden tests run on Submit