Merge arrays in an object

I have an object of array ike the following:

[
  [
    1143808,
    1143809
  ],
  [
    1143810
  ]
]

Can I merge it such that the end result is like the following?

[ 1143808, 1143809, 1143810]

Even if there are same numbers, I don’t want to remove the duplicates and want to retail all numbers. The above arrays in an object is dynamically generated so it can be different all time.

You can use Array.flat() to achieve that.

const results = [ [ 1143808, 1143809 ], [ 1143810 ] ]

results.flat() // [ 1143808, 1143809, 1143810 ]
2 Likes