0

I have this array:

var arrayPpal = [];

with this question I want to know how I can add the elements of other arrays to arrayPpal on the same level without having to perform cycles(without using cycle for, while.) or something like that.

var array1 = [1,2,3,4,5,6,7];
var array2 = [8,9,10];

the output should be:

arrayPpal = [1,2,3,4,5,6,7,8,9,10];

https://jsfiddle.net/m57axggp/

Mihai Alexandru-Ionut
  • 47,092
  • 13
  • 101
  • 128
unusuario
  • 151
  • 1
  • 13

1 Answers1

1

Use the concat method.

var arrayPpal=[];

var array1 = [1,2,3,4,5,6,7];
var array2 = [8,9,10];

arrayPpal = array1.concat(array2);

alert(arrayPpal);

Updated Fiddle

Fueled By Coffee
  • 2,467
  • 7
  • 29
  • 43