From b180c7fe28864f66f8c2be685021d89cb7f2989a Mon Sep 17 00:00:00 2001 From: yosito Date: Sat, 18 Sep 2021 22:22:15 +0900 Subject: [PATCH] =?UTF-8?q?=E9=80=86=E9=A0=86=E3=81=AE=E3=83=A9=E3=83=B3?= =?UTF-8?q?=E3=82=AD=E3=83=B3=E3=82=B0=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index ff2e98b9..21c97000 100644 --- a/app.js +++ b/app.js @@ -32,10 +32,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] ,rank) => { + return (rank + 1) + "位" + key + ': ' + value.popu10 + '=>' + value.popu15 + ' 変化率:' + value.change; }); console.log(rankingStrings); }); \ No newline at end of file