Javascript equivalent of Python's zip function

前端 未结 18 1607
天命终不由人
天命终不由人 2020-11-21 07:40

Is there a javascript equivalent of Python\'s zip function? That is, given multiple arrays of equal lengths create an array of pairs.

For instance, if I have three

18条回答
  •  隐瞒了意图╮
    2020-11-21 07:55

    1. Npm Module: zip-array

    I found an npm module that can be used as a javascript version of python zip:

    zip-array - A javascript equivalent of Python's zip function. Merges together the values of each of the arrays.

    https://www.npmjs.com/package/zip-array

    2. tf.data.zip() in Tensorflow.js

    Another alternate choice is for Tensorflow.js users: if you need a zip function in python to work with tensorflow datasets in Javascript, you can use tf.data.zip() in Tensorflow.js.

    tf.data.zip() in Tensorflow.js documented at here

提交回复
热议问题