combine arrays

Description

.merge() combine arrays. It takes the elements from a second array and appends them to the elements of a first array, preserving the order of the elements of the two arrays:

Example


<!DOCTYPE html> 
<html>
<head> 
    <script src="http://yourServer.com/jQuery/jquery.min.js"></script> 
    <script> 
        var letters =  ["A",  "B", "C"];
        var nums  =  [1,2,3];
        var mergedArrays =  $.merge(letters,  nums);
        console.log(mergedArrays); <!--from   w  ww .j  a va  2 s . com-->
    </script> 
</head> 
<body> 
  <p>Your tags here</p>
</body> 
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Tutorial »




Basics
Selector
DOM
Event
Effect
Utilities