# Tuple in for loop

I have the following code in python that works fine in psychopy, but doesn’t convert to JS because JS doesn’t have tuples. Does anyone have any suggestions on how to convert the following python code to JS:

``````i = 0

for label, block in blocks_3.items():
block.pos = locations_1[i]
i = i + 1
block.color = 'white'

``````

Here is the full code:

``````blkIndex_3 = 0
nextSwitch_3 = blockDuration
doingResponse_3 = False
currBlock_3 = None

blocks_3 = {}
blocks_3['blk1_3']=blk1_3
blocks_3['blk2_3']=blk2_3
blocks_3['blk3_3']=blk3_3
blocks_3['blk4_3']=blk4_3
blocks_3['blk5_3']=blk5_3
blocks_3['blk6_3']=blk6_3
blocks_3['blk7_3']=blk7_3
blocks_3['blk8_3']=blk8_3
blocks_3['blk9_3']=blk9_3

locations = [(-.52, 0.3), (-.52, 0.03), (-.52, -0.25), (0.04, 0.3), (0.04, 0.03),(0.04,-.25), (0.47, 0.3), (0.47, 0.03), (0.47, -0.25)]

jitter = [np.random.uniform(-0.1, 0.1) for x in range(18)]

locations_1 = [

[locations[0][0] + jitter[0],

locations[0][1] + jitter[1]],

[locations[1][0] + jitter[2],

locations[1][1] + jitter[3]],

[locations[2][0] + jitter[4],

locations[2][1] + jitter[5]],

[locations[3][0] + jitter[6],

locations[3][1] + jitter[7]],

[locations[4][0] + jitter[8],

locations[4][1] + jitter[9]],

[locations[5][0] + jitter[10],

locations[5][1] + jitter[11]],

[locations[6][0] + jitter[12],

locations[6][1] + jitter[13]],

[locations[7][0] + jitter[14],

locations[7][1] + jitter[15]],

[locations[8][0] + jitter[16],

locations[8][1] + jitter[17]]]

np.random.shuffle(locations_1)

i = 0
for label, block in blocks_3.items():
block.pos = locations_1[i]
i = i + 1
block.color = 'white'

``````