Skip to content

TypeScript code snippet – How to remove second square brackets in an array?

const data = [
  [
    {id: 1},
    {id: 2}
  ],
  [
    {id: 3},
    {id: 4}
  ]
];

const newData = [].concat(...data);
console.log(newData);
See also  How to sum numbers of a list in Python without sum?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.