I have an array in the form
[
['16-24', 192081],
['16-24', 94452],
['16-24', 1055],
['25-34', 192081],
['25-34', 94452],
['25-34', 1055],
...
]
I have many items in the array that I'd like to reduce down to the unique left-hand entries. This is an example of what I'd like to reduce down to
[
['16-24', 287588],
['25-34', 287588],
...
]
Obviously the numbers here are a contrived example. I've looked into javascript's array reduce but I'm unsure how to use it to achieve this effect
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…