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  Python code snippet - How to install library vsExample?

Leave a Reply

Your email address will not be published. Required fields are marked *

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