From 591ac71a102b1af77805ddc8958f56f0e16ddb3e Mon Sep 17 00:00:00 2001 From: yukihirokoma Date: Fri, 23 Jul 2021 10:56:15 +0900 Subject: [PATCH] =?UTF-8?q?=E8=AA=B2=E9=A1=8C=E5=AE=9F=E8=A3=85?= 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..44faef0b 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