- Edited
Hi I have a generated array of arrays, [[0,2], [5,0], [2,9], [10,5], [9,10]]
that I would like to sort using loops so that the second value aligns with the first value of the subsequent array [[0,2],[2,9],[9,10],[10,5],[5,0]]
.
My idea for how I could do this go something like this but Ive become a bit stuck:
var original = [[0,2], [5,0], [2,9], [10,5], [9,10]]
var holdingArray= [original[1]]
for a in original:
if a[0] == original[1][1]:
holdingArray.append(a)