DEV Community

aoguzie
aoguzie

Posted on

1

Dynamically merge all objects in different arrays (appending names instead of ignoring)

I want to combine two arrays with common properties:

var ranking = [{
    def: "0.58"
    league: "Scottish Premiership",
    name: "Celtic",
    off: "3.33",
    grank: "3",
    tform: "96.33",
},
{
    def: "2.52",
    league: "Scottish Premiership",
    name: "Dundee",
    off: "1.28",
    grank: "302",
    tform: "27.51",
}]
var matches = [{
date: "2010-04-22",
league: "Scottish

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay