johnpaulada
1/23/2017 - 7:10 AM

Recursive array zip in Javascript.

Recursive array zip in Javascript.

function zip(a, b) {
  return a.length ? [[a[0], b[0]]].concat(zip(a.slice(1), b.slice(1))) : []
}