Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Closures in coffeescript
makeLogger = (prefix) ->
(message) -> console.log "#{prefix.toUpperCase()}: #{message}"
fooLogger = makeLogger 'foo'
barLogger = makeLogger 'bar'
fooLogger n for n in [1..10]
barLogger n for n in [1..10]
fooLogger n for n in [11..20]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.