Skip to content
Advertisement

Creating a function that works like “zip”

I am trying to make a function that does something similar to “zip”. My problem is that the part

JavaScript

doesn’t work. In the case below, it should take every third element from the L4, and append it to a new list, so I ended up with [[1, 4, 7], [2, 5, 8], [3, 6, 9]], but that is not really what is happening. Also, it would be even better if I could make tuples, so it would look like [(1, 4, 7), (2, 5, 8), (3, 6, 9)], but I don’t know how to do that…

JavaScript

Advertisement

Answer

Try this one.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement