diff --git a/app.js b/app.js index 7488b5d2..a59846b4 100644 --- a/app.js +++ b/app.js @@ -33,10 +33,10 @@ rl.on('close', () => { value.change = value.popu15 / value.popu10; } const rankingArray = Array.from(prefectureDataMap).sort((pair1, pair2) => { - return pair2[1].change - pair1[1].change; + return pair1[1].change - pair2[1].change; }); - const rankingStrings = rankingArray.map(([key, value]) => { - return key + ': ' + value.popu10 + '=>' + value.popu15 + ' 変化率:' + value.change; + const rankingStrings = rankingArray.map(([key, value], i) => { + return (i + 1) + '位' + key + ': ' + value.popu10 + '=>' + value.popu15 + ' 変化率:' + value.change; }); console.log(rankingStrings); });