en.javascript.info/1-js/4-data-structures/5-object-for-in/3-max-salary/solution.md
2015-03-10 12:36:58 +03:00

309 B

//+ run
"use strict";

var salaries = {
  "Вася": 100,
  "Петя": 300,
  "Даша": 250
};

var max = 0;
var maxName = "";
for (var name in salaries) {
  if (max < salaries[name]) {
    max = salaries[name];
    maxName = name;
  }
}

alert( maxName || "нет сотрудников" );