Merge two arrays : merge « jQuery « JavaScript DHTML






Merge two arrays

 

<html>
  <head>
    <script type='text/javascript' src='js/jquery-1.3.2.js'></script>
    <script type='text/javascript'>
$(document).ready(
  function() {
    var $vegetables = [
      'C',
      'T',
      'L'
    ];
    var $fruits = [
      'C',
      'A',
      'C'                   
    ];
    
    $merged = $.merge($vegetables, $fruits);
    var $string = '';
    $($merged).each(
      function() {
         $string += this + "\n";   
      }
    );
    
    alert($string);
  }
);
    </script>
  </head>
  <body>
  </body>
</html>

   
  








Related examples in the same category

1.Merge array
2.Merge array and get the unique