How to combine/join arrays using jQuery

In this post, we will see that "how to join or combine arrays using jQuery".

Earlier I had posted about jQuery solution to remove item from array, split an array and Find index of element in array, And In this post, find how to combine/join arrays with example.

Below jQuery code joins the two arrays using jQuery.

$(document).ready(function() {
  var arrFirst = [50, 10, 19, 22];
  var arrSecond = [6, 74]; 
  var arrJoin = arrFirst.concat(arrSecond);

In this jQuery code, I have used the concat() method. contact() is the method of an array object and it is invoked on the first array and the second array is passed to it as a parameter. And it returns another array which is combination of both the arrays elements.

See result below.

Feel free to contact me for any help related to jQuery, I will gladly help you.

Responsive Menu
Add more content here...