Skip to content

Commit

Permalink
result6 の作成を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
jun68ykt committed Aug 9, 2019
1 parent c6ffc00 commit 711cd53
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.js
Expand Up @@ -34,6 +34,17 @@ document.addEventListener('DOMContentLoaded', function() {
})
,{});
console.log(result5);

const summarize = (ary) => {
const map = ary.reduce((m, e) => m.set(e[0], (m.get(e[0]) || 0) + e[1]), new Map());
return [...map].sort((e1,e2) => e1[0].localeCompare(e2[0]));
}

const result6 = Object.entries(result5).reduce(
(obj, [k,v]) => ({...obj, [k]: summarize(v)})
, {});

console.log(result6);
}
},false);

Expand Down

0 comments on commit 711cd53

Please sign in to comment.