c
Size: a a a
c
S🛸
c
АР
c
S🛸
DB
let data = [
{
type: "1",
data: 123,
},
{
type: "1",
data: 5,
},
{
type: "1",
data: 5,
},
{
type: "1",
data: 5,
},
{
type: "1",
data: 5,
},
]
data.reduce((acc, item, i) => {
let index = acc.findIndex((i) => i.data === item.data)
if (index !== -1) {
acc[index].count = acc[index].count ? acc[index].count + 1 : 2
} else {
acc[i] = item
}
return acc
}, [])
S🛸
let data = [
{
type: "1",
data: 123,
},
{
type: "1",
data: 5,
},
{
type: "1",
data: 5,
},
{
type: "1",
data: 5,
},
{
type: "1",
data: 5,
},
]
data.reduce((acc, item, i) => {
let index = acc.findIndex((i) => i.data === item.data)
if (index !== -1) {
acc[index].count = acc[index].count ? acc[index].count + 1 : 2
} else {
acc[i] = item
}
return acc
}, [])
DB
S🛸
АР
АР
S🛸
c
DB
c
АР
c
c
АР