var salaries = { "Вася": 100, "Петя": 300, "Даша": 250 }; function maxsalary(obj){ var sum = 0; for(var key in salaries){ if(sum < salaries[key]){ sum = salaries[key] } } var d = sum + ' ' + key; return d; } console.log(maxsalary(salaries));
There is an object
salaries
with salaries. Write the code that displays the name of the employee who has the highest salary.If the object is empty, then let it display “no employees”.
I do not know how to make it display "no employees" if the object is empty
var array = Object.keys({...})
, and then working with the array - Alexander Lonberg