This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Flatten a multidimentional array of integers to a single dimention with the integer values | |
*/ | |
function flatten_array(arr) { | |
var newArr = [] | |
for (var idx=0; idx<arr.length; idx++) { | |
if (Array.isArray(arr[idx])) { | |
var a = flatten_array(arr[idx]); | |
for (var i=0; i<a.length; i++) { | |
newArr.push(a[i]); |