Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
How to push all these objects in different nested array into one array?
(2) [Array(2), Array(1)]
0: Array(2)
0: {_id: '61cd4544264332414823198d', action: 'checkin', time: '2021-12-30T05:36:04.143Z'}
1: {_id: '61cd60713082f35340af2a87', action: 'checkout', time: '2021-12-30T07:32:01.986Z'}
length: 2
[[Prototype]]: Array(0)
1: Array(1)
0: {_id: '61cd455a26433241482319a5', action: 'checkin', time: '2021-12-30T05:36:26.346Z'}
length: 1
[[Prototype]]: Array(0)
length: 2
[[Prototype]]: Array(0)

I want all objects into one array like :

[
0: {_id: '61cd4544264332414823198d', action: 'checkin', time: '2021-12-30T05:36:04.143Z'}
1: {_id: '61cd60713082f35340af2a87', action: 'checkout', time: '2021-12-30T07:32:01.986Z'}
2: {_id: '61cd455a26433241482319a5', action: 'checkin', time: '2021-12-30T05:36:26.346Z'}
]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can try this:

const input = [[{_id: '61cd4544264332414823198d', action: 'checkin', time: '2021-12-30T05:36:04.143Z'},
{_id: '61cd60713082f35340af2a87', action: 'checkout', time: '2021-12-30T07:32:01.986Z'}], [{_id: '61cd455a26433241482319a5', action: 'checkin', time: '2021-12-30T05:36:26.346Z'}]];

console.log(input.flat());
// output: > Array [Object { _id: "61cd4544264332414823198d", action: "checkin", time: "2021-12-30T05:36:04.143Z" }, Object { _id: "61cd60713082f35340af2a87", action: "checkout", time: "2021-12-30T07:32:01.986Z" }, Object { _id: "61cd455a26433241482319a5", action: "checkin", time: "2021-12-30T05:36:26.346Z" }]

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!