milov.nl

Interaction design • webdevelopment • web art • photography

August 2001

Shortest syntax for preloading images in Javascript (in answer to a question by Wouterd yesterday):

for(i in ['larry.gif','moe.gif',
'curly.gif'])(new Image()).src=M[i];



Traumwind wrote on 2001/08/02:
that can be shortened:
for(i in M=['larry.gif','moe.gif','curly.gif'])(new Image()).src=M[i];

[] replaces the new Array constructor...
cool stuff, man!


milov wrote on 2001/08/02:
sweet!