This sample flattens a nested array using CoffeeScript.
flatten = (array) ->
array.reduce(((x, y) -> if Array.isArray(y) then x.concat(flatten(y)) else x.concat(y)), [])
console.log flatten [1, [2, 3, [4, 5]], 6, [7, [8, [9], 10] ,11 , 12], 13]
>>> [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ]