Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

人口が減った都道府県ランキングの実装 #1831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});