Skip to content

Commit

Permalink
降順に変更
Browse files Browse the repository at this point in the history
  • Loading branch information
suitakahashi committed Jul 16, 2021
1 parent 1f36b59 commit d1796ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

0 comments on commit d1796ab

Please sign in to comment.