That is to make this:
[ [\'dog\',\'cat\', [\'chicken\', \'bear\'] ],[\'mouse\',\'horse\'] ]
into:
[\'dog\',\'cat\',\'chicken\',\'
That's why I love javascript:
function flattenArray(source) { return source.toString().split(','); } flattenArray([['dog', 'cat', ['chicken', 'bear']], ['mouse', 'horse']]); // -> ['dog','cat','chicken','bear','mouse','horse']