austbot
6/9/2016 - 6:47 PM

flatten_recursive.js

function flatten(arrInput) {
  if(arrInput.length < 1 || !arrInput) return [];
  var arr = [];
	arrInput.map(function(e, index){
  	if(Array.isArray(e)) arr= arr.concat(flatten(e));
    else arr.push(e);
  });
  return arr;
}