title: How to flatten a clamped array
body: <p>At the minute I find myself stuck trying to flatten a <code>Uint8ClampedArray</code>.</p>
  <p>The starting array structure is <code>data = [227, 138, 255…]</code> and after creating an array from that of the like <code>enc = [Uint8ClampedArray[900], Uint8ClampedArray[900], Uint8ClampedArray[900]...]</code> I try to flatten it.</p>
  <p>I tried many methods / solutions for that but no one seems to work:</p>
  <p>the MDN suggested method</p>
  <pre><code>var flattened = [[0, 1], [2, 3], [4, 5]].reduce(function(a, b) {
    return a.concat(b);
  }, []);
  </code></pre>
  <p>with concat</p>
  <pre><code>data = [].concat.apply([], enc);
  </code></pre>
  <p>and through a function</p>
  <pre><code>function flatten(arr) {
    return arr.reduce(function (flat, toFlatten) {
      return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
    }, []);
  }
  </code></pre>
  <p>but no joy so far, it keeps returning the array as it is. Anyone can point me in the right direction and explain why is that?</p>
  <p>-EDIT-
  Bottom line: I need it to return a regular Array object, like the starting one not typed.</p>