Javascript Array zip(arrays)

Description

Javascript Array zip(arrays)


Array.prototype.zip = function(arrays) {
  let numArrays = arguments.length;
  var array;/*w w w .  j  a  v a 2  s. co  m*/
  for(let i = 0; i < numArrays; i ++) {
    var k = numArrays[i].length
   array[i] = []
    for(var j = 0; j < k; j++){
      array[i].push(numArrays[i][j])}
  }
  return array
}



PreviousNext

Related