<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Merge Multiple Arrays To One Without Using Loop &#8211; Sibeesh Passion</title>
	<atom:link href="https://sibeeshpassion.com/tag/merge-multiple-arrays-to-one-without-using-loop/feed/" rel="self" type="application/rss+xml" />
	<link>https://sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Fri, 21 Aug 2015 06:50:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Merge Multiple Arrays To One Without Using Loop &#8211; Sibeesh Passion</title>
	<link>https://sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Merge Multiple Arrays To One</title>
		<link>https://sibeeshpassion.com/merge-multiple-arrays-to-one/</link>
					<comments>https://sibeeshpassion.com/merge-multiple-arrays-to-one/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Tue, 18 Aug 2015 12:06:45 +0000</pubDate>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[jquery array]]></category>
		<category><![CDATA[jquery functions]]></category>
		<category><![CDATA[Merge Multiple Arrays To One]]></category>
		<category><![CDATA[Merge Multiple Arrays To One Without Using Loop]]></category>
		<guid isPermaLink="false">http://sibeecst_passion.com/?p=9791</guid>

					<description><![CDATA[In this post we will discuss how we can merge multiple arrays to one array using JQuery. There are so many ways to achieve this. Like we can loop through each array and push it to other array one by one or we can join those arrays one by one. Or we can use JQuery function merge() . But requirement was bit different. Since I was using large data, I was not able to use any loop or any long processes. We will discuss an easy way here in this article. I hope you will like this. Background Recently I [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In this post we will discuss how we can merge multiple arrays to one array using <a href="http://sibeeshpassion.com/tag/jquery/" target="_blank">JQuery</a>. There are so many ways to achieve this. Like we can loop through each array and push it to other array one by one or we can join those arrays one by one. Or we can use <a href="http://sibeeshpassion.com/tag/jquery-functions/" target="_blank">JQuery function</a> <em>merge() </em>. But requirement was bit different. Since  I was using large data, I was not able to use any loop or any long processes. We will discuss an easy way here in this article. I hope you will like this. </p>
<p><strong>Background</strong></p>
<p>Recently I got a requirement of merging large collections of client side arrays to one array. The problem was the arrays were dynamic, hence I was not sure about the count of those arrays, it may be different in different times. So what to do? A loop, merge, push, join in jquery was not a perfect solution for me since the data was large. So I found the solution in other way. </p>
<p><strong>Using the code</strong></p>
<p>Consider we have some arrays as follows.</p>
<p>[js]<br />
[21,2], [35,4], [25,6],[11,6],[44,67]<br />
[/js]</p>
<p>Now we need to change these arrays to a variable.</p>
<p>[js]<br />
var myArrays = [[21,2], [35,4], [25,6],[11,6],[44,67]];<br />
[/js]</p>
<p>Now here comes the real part.</p>
<p>[js]<br />
var myArray = [].concat.apply([], myArrays);<br />
[/js]</p>
<p>We are using <em>jquery concat</em> and <em>jquery apply()</em> function.</p>
<p>Now we will write this array to console.</p>
<p>[js]<br />
console.log(myArray);<br />
[/js]</p>
<p>See the console, you can get the values as follows.</p>
<div id="attachment_9801" style="width: 549px" class="wp-caption alignnone"><a href="http://sibeeshpassion.com/wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-9801" src="http://sibeeshpassion.com/wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One.png" alt="Merge Multiple Arrays To One" width="539" height="270" class="size-full wp-image-9801" srcset="/wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One.png 539w, /wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One-300x150.png 300w, /wp-content/uploads/2015/08/Merge_Multiple_Arrays_To_One-400x200.png 400w" sizes="(max-width: 539px) 100vw, 539px" /></a><p id="caption-attachment-9801" class="wp-caption-text">Merge Multiple Arrays To One</p></div>
<p>You can see the demo at jsfiddle here: <a href="http://jsfiddle.net/sibeeshvenu/xyhc28jt/" target="_blank">Merge Multiple Arrays To One</a></p>
<p><strong>Conclusion</strong></p>
<p>I hope someone found it useful. Please share me your valuable suggestions and feedback. Thanks in advance.</p>
<p>Kindest Regards<br />
Sibeesh Venu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sibeeshpassion.com/merge-multiple-arrays-to-one/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
