-4

How do i concatenate these two arrays to get the expected output?

let bidder= [
  [1,2,3,4],
  [5,6,7,8]
]

let arr1 = [9,10,11,12]

expected result

[
(4) [...],
(4) [...],
(4) [...],
]
p.maimba
  • 33
  • 8

1 Answers1

0

const bidder= [
  [1,2,3,4],
  [5,6,7,8]
]

const arr1 = [9,10,11,12];
const result = [...bidder, arr1];
console.log(result);

You can use spread operator to spread whatever is in bidder array and add your other array as the last one in a new array.

Nicolae Maties
  • 2,476
  • 1
  • 16
  • 26