-2

if array1 = [1, 2, 3, 4];

then array2 = [5, 6, 7];

In the end i want all these values to be in one array as

array3 = [1, 2, 3, 4, 5, 6, 7]

1 Answers1

0

You can use concat method like this

let array1 = [1, 2, 3, 4];

let array2 = [5, 6, 7];

let array3 = array1.concat(array2);

console.log(array3)
Hien Nguyen
  • 24,551
  • 7
  • 52
  • 62