Mode entretien. Minuteur de 5 min, sans indices ni autocomplétion
Top salary
FacileObjects5 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.
Exemples
topSalary({ John: 100, Pete: 300, Mary: 250 })Renvoie 'Pete'
topSalary({})Renvoie null
topSalary({ Ann: 0 })Renvoie 'Ann'
Chargement de l'éditeur...
- Entrée
topSalary({ John: 100, Pete: 300, Mary: 250 })Attendu'Pete' - Entrée
topSalary({})Attendunull - Entrée
topSalary({ Ann: 0 })Attendu'Ann'
Les tests cachés se lancent à la soumission