JavaScript's method of inserting an array into another array

  • 2020-05-17 04:46:02
  • OfStack

This example shows how JavaScript inserts one array into another. Share with you for your reference. The specific analysis is as follows:

This JS code inserts one array into another array through the Array.prototype.push.apply method, and the following code inserts the array b into a


var a = [4,5,6];
var b = [7,8,9];
Array.prototype.push.apply(a, b);
uneval(a); // is: [4, 5, 6, 7, 8, 9]

I hope this article has been helpful to your javascript programming.


Related articles: