Create a new result from an existing array
问题 If I have a sample data that looks like this I need to get finalResult array from result array: let result = [{ type: ['Science'], link: "www.educatorsector.com" }, { type: ['Sports', 'News'], link: "www.skysports-news.com" }, { type: ['Sports', 'Science'], link: "www.cnn-news.com" }]; finalResult = [ { type : "Science", numberOfLinks : 2 }, { type : "Sports", numberOfLinks : 2 }, { type : "News", numberOfLinks : 1 }] orThisFinalResult = [ { type : "Science", links : ["www.educatorsector.com"