From 18771e851bcbe4819cfc114721777a7efae60bfe Mon Sep 17 00:00:00 2001 From: dddsss9761 <141099385+dddsss9761@users.noreply.github.com> Date: Fri, 4 Aug 2023 12:46:09 +0900 Subject: [PATCH] Update app.js --- app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 7488b5d2..16e2b47c 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((pair, i) => { + return (i + 1)+ '位 ' + pair[0] + ': ' + pair[1].popu10 + '=>' +pair[1].popu15 + ' 変化率:' + pair[1].change; }); console.log(rankingStrings); });