newbie here. I have a set of arrays. My target is to join 1 data to another data if they have the same values. For example, player 1 = level 1, and player 6 = level 1, therefore they'll be joined on the same array and inserted to the database. As far as I know, I think it has to do with for-each. How can I make it work? Thank you in advance.
const players = [
    {
        id: 1,
        name: 'player1',
        level: '1',
    
    },
    {
        id: 2,
        name: 'player2',
        level: '2',
     
    },
    {
        id: 3,
        name: 'player3',
        level: '3',
  
    },
    {
        id: 4,
        name: 'player4',
        level: '3',
      
    },
    {
        id: 5,
        name: 'player5',
        level: '2',
     
    },
    {
        id: 6,
        name: 'player6',
        level: '1',
     
    }
];

 
     
    