Last Updated: February 25, 2016
· dustinrjo

Simple Fiddle for scoping in coffeescript array loop

It can be difficult to follow variables throughout a loop in Coffeescript, so I made this fiddle to test out the shortest syntax to loop and return conditionally only if a criteria is met.

a = [

testfunc = (b) ->
    e = ""
    for c in b
        do (c) ->
            if c is "bird"
                e = c
    return e

console.log testfunc(a)