Is there a built-in way to join two arrays in ColdFusion, similar to JavaScript's array.concat()
?
To merge elements from one array to another, we must first iterate(loop) through all the array elements. In the loop, we will retrieve each element from an array and insert(using the array push() method) to another array. Now, we can call the merge() function and pass two arrays as the arguments for merging.
The concat() method concatenates (joins) two or more arrays. The concat() method returns a new array, containing the joined arrays. The concat() method does not change the existing arrays.
The concat() method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array.
The Array. concat() is an inbuilt TypeScript function which is used to merge two or more arrays together.
Not really, but guess what, just use Java! :)
<cfset foo = [1,2,3]> <cfset bar = [4,5,6]> <cfset foo.addAll( bar )>
reference: Java's Collection Interface API.
source: http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/merging-two-arrays-267
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With