Array takes the same object and accumulates

there are duplicate values under an array. You want to calculate the accumulations of the same values
such as: var arr = [{id: 1}, {id: 2}, {id: 3}, {id: 1}, {id: 1}]

.

the value you want to return is [{id: 1} * 3 , {id: 2}, {id: 3}]

Please ignore the syntax of * 3, just hope to achieve this effect. Now ask for good solutions.

say the required case: multiple projects, the project may have the same value. If you have one, you will synthesize one. And give the project synthesis times of the same value ()?

Sep.17,2021

   

Menu