const people = ["홍길동", "엄석대", "연개소문", "김첨지"];
const dishes = [2, 1, 10, 0];
function eatingContest(people, dishes) {
return people
.map((name, idx) => ({ name, count: dishes[idx] }))
.sort((a, b) => b.count - a.count)
.reduce((hash, { name, count }, idx) => {
hash[name] = idx + 1;
return hash;
}, {});
}