Home > database >  How to get specific object item from array of objects
How to get specific object item from array of objects

Time:01-28

I'm having this map function to map through some table data.

const Rows = dataToFilter.children.map((row: any) => {
    return row.table_row;
  });
console.log("ROWSSS", Rows);

...and as a result i'm getting this complex array of objects:

enter image description here

How can i get the two columns of arrays highlited?

CodePudding user response:

Don't have the data to test, but this could be a possibility

const Rows = dataToFilter.children.map((row: any) => {
  const [colOne, colTwo] = row.table_row.cells;

  return {
    colOne,
    colTwo
  }

});
  • Related