Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
ary = [1..3]
# immediate 1
# immediate 2
# immediate 3
for i in ary
console.log "immediate #{i}"
# functions 3
# functions 3
# functions 3
fns = for i in ary
-> console.log "functions #{i}"
fn() for fn in fns
# functions with closure 1
# functions with closure 2
# functions with closure 3
fns = for i in ary
do (i) ->
-> console.log "functions with closure #{i}"
fn() for fn in fns
# deferred 3
# deferred 3
# deferred 3
for i in ary
setTimeout ->
console.log "deferred #{i}"
, 1000
# deferred with closure 1
# deferred with closure 2
# deferred with closure 3
for i in ary
do (i) ->
setTimeout ->
console.log "deferred with closure #{i}"
, 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.