I'm building a jigsaw-puzzle based Hype. The code works, but looking back at it I can't help feeling that a really proficient JavaScripter would have written far fewer lines. And this bugs me. Here is one example. I'm filling a global customData property called dropPlaces with the initial (x,y) positions of the 24 jigsaw pieces, arranged by rows and columns, having already stored the elementIDs of those pieces in another customData property called pieces, also arranged in rows and columns. Here's my code for this bit. As you can see, it looks massively repetitive and seems to be crying out for some sort of for loop, but I can't think of a suitable syntax. Is there one?
hypeDocument.customData.dropPlaces = [
[{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][0],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][0],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][1],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][1],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][2],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][2],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][3],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][3],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][4],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][4],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][5],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[0][5],'top')}],
[{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][0],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][0],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][1],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][1],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][2],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][2],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][3],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][3],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][4],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][4],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][5],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[1][5],'top')}],
[{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][0],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][0],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][1],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][1],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][2],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][2],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][3],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][3],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][4],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][4],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][5],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[2][5],'top')}],
[{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][0],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][0],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][1],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][1],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][2],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][2],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][3],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][3],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][4],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][4],'top')},
{x:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][5],'left'),y:hypeDocument.getElementProperty(hypeDocument.customData.pieces[3][5],'top')}]
];
Thanks, guys.