Skip to content
Advertisement

How can I join an object with arrays into a single array using javascript?

This is what I have (wealthByDistribution) and I require a solution like (expectedArray).

JavaScript

Please if anyone can help me, I have been trying to solve it out for quite some time. I tried the following code, but it did not work as expected.

JavaScript

Advertisement

Answer

By using corresponding keys, you could collect all value with year/month and get a combined result.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement