Javascript Array flatten(array)
Array.prototype.flatten = function(array) { return this.reduce((prev, next) => prev.concat(next), []); };