From 3fcc40cc95b70dcaf851dfb8daf9275ffd815ced Mon Sep 17 00:00:00 2001 From: daikisakuma Date: Mon, 27 Sep 2021 21:54:33 +0900 Subject: [PATCH] master --- app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); });