Skip to content

Instantly share code, notes, and snippets.

@aach
Created June 4, 2013 19:47
Show Gist options
  • Save aach/5708936 to your computer and use it in GitHub Desktop.
Save aach/5708936 to your computer and use it in GitHub Desktop.
function async( fn )
{
window.setTimeout( fn, 0 );
}
function problem()
{
for( var i = 0; i < 10; i++ )
{
async( function ()
{
console.log( i );
} );
}
}
function solution()
{
for( var i = 0; i < 10; i++ )
{
( function( i )
{
async( function ()
{
console.log( i );
} );
}( i ) );
}
}
@piecioshka
Copy link

Good solution ;)

@isra00
Copy link

isra00 commented Jun 4, 2013

Cool! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment