This question has already been answered:
- Delete duplicate array 3 replies
Good day to all.
Trying to solve the problem:
Suppose there is an object with duplicate properties of nested objects:
var obj = { [0] = { title: 'Дверь', color: 'Белая' } [1] = { title: 'Дверь', color: 'Белая' } [2] = { title: 'Дверь', color: 'Черная' } [3] = { title: 'Дверь', color: 'Черная' } [4] = { title: 'Дверь', color: 'Серая' } } It is necessary to build on this basis a new object of this type:
var obj = { [0] = { title: 'Дверь', color: 'Белая', count: 2 } [1] = { title: 'Дверь', color: 'Черная', count: 2 } [2] = { title: 'Дверь', color: 'Серая', count: 1 } } PS The value of the title property can be changed in the same way as color .