Last active
July 31, 2019 13:15
-
-
Save thecolorblue/fc5af3b65cba58d16bf624cfa9d981c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function transpose(array) { | |
| // split rows | |
| array = array.map(r=>r.split('')); | |
| // transpose | |
| array = array[0].map((r, i)=> array.map(c=>c[i])); | |
| // merge rows | |
| return array.map(r=> r.join('')); | |
| } | |
| transpose(["AAAAAAAAA"]) | |
| transpose(["AAA", "BBB", "CCC"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment