JSFiddle - React, Tailwind, and code Playground

by Randy Crews

JavaScript

const linkedUserAccounts = [{
    accounts: [{
      name: 'ABC',
      guid: 'some account guid 0',
    }, {
      name: 'DEF',
      guid: 'some account guid 1',
    }],
    name: 'Inst-1',
    member_guid: 'membguid1',
  }, {
    accounts: [{
      name: 'GHI',
      guid: 'some account guid 2',
    }, {
      name: 'KLM',
      guid: 'some account guid 3',
    }],
    name: 'Inst-2',
    member_guid: 'some other member guid',
  }];
  
const result = linkedUserAccounts.forEach(accounts => console.log(accounts.accounts.find(({name}) => name === 'DEF')));
const index = linkedUserAccounts.forEach(accounts => console.log(accounts.accounts.findIndex(({name}) => name === 'ABC')));