Concatenate multiple arrays into one
Thought this would be really simple but there's isn't a ".concat" method in Hise
I'm just simply trying to get the following arrays:
var arrayA = [ 1, 2, 3];
var arrayB = [ 4, 5, 6];
var arrayC = [ 7, 8, 9];
Merged into one new array so that the output is:
NewArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9]
@LeeC I guess looping through each array and pushing values to the new array is the way forward.
I just hoped that there would be a simpler method as I have to do this for quite a lot of arrays.
I have a concatenate function in my github repo - https://github.com/davidhealey/HISE-Scripting-Framework/blob/master/libraries/objectHelpers.js
@d-healey thanks for this.
Also, do you know how to use the following ".sort" in HISE to order an array ascending numerically?
const var arr = [5, 3, 6, 7, 1]; arr.sort(); Console.print(trace(arr));
ustk last edited by
@d-healey I didn't know about the
@ustk I have a video about it on Patreon.