Javascript equivalent of Python’s zip function
2016 update: Here’s a snazzier Ecmascript 6 version: zip= rows=>rows[0].map((_,c)=>rows.map(row=>row[c])) Illustration equiv. to Python{zip(*args)}: > zip([[‘row0col0’, ‘row0col1’, ‘row0col2’], [‘row1col0’, ‘row1col1’, ‘row1col2’]]); [[“row0col0″,”row1col0”], [“row0col1″,”row1col1”], [“row0col2″,”row1col2”]] (and FizzyTea points out that ES6 has variadic argument syntax, so the following function definition will act like python, but see below for disclaimer… this will not be its own inverse … Read more