已知endorsement array, 要求写一个function实现想要输出的结果:
// function input
var endorsements = [
{ skill: 'javascript', user: 'Chad' },
{ skill: 'javascript', user: 'Bill' },
{ skill: 'javascript', user: 'Sue' },
{ skill: 'html', user: 'Sue' },
{ skill: 'css', user: 'Sue' },
{ skill: 'css', user: 'Bill' }
];
// function output
[
{ skill: 'javascript', user: [ 'Chad', 'Bill', 'Sue' ], count: 3 },
{ skill: 'css', user: [ 'Sue', 'Bill' ], count: 2 },
{ skill: 'html', user: [ 'Sue' ], count: 1 }
];