From 6128a523b582a87f44eebb0a67ced1fb7bc42321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=89=E5=81=A5=E5=A4=AA=E6=9C=97?= Date: Fri, 7 Jan 2022 00:43:04 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E3=81=8C=E6=B8=9B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E5=89=B2=E5=90=88=E3=81=AE=E3=83=A9=E3=83=B3=E3=82=AD=E3=83=B3?= =?UTF-8?q?=E3=82=B0=E3=81=AB=E5=A4=89=E6=9B=B4?= 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..474b28c4 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], i) => { + return i+1 + '位 ' + key + ': ' + value.popu10 + '=>' + value.popu15 + ' 変化率:' + value.change; }); console.log(rankingStrings); }); \ No newline at end of file