The closure tag has no wiki summary.
1
vote
2answers
70 views
Cleanest way to close over a counter in CoffeeScript
I haven't spent too much time with CoffeeScript and am trying to have a simple counter:
casper.on('step.complete', ( ->
i = 0
return (step) ->
i += 1
...
0
votes
0answers
107 views
Array Creation Inspired by Python's List Comprehension
I challenged myself to develop something functionally similar to Python's list-comprehension. Below is what I came up with. Obviously, Javascript doesn't have the elegant syntax, so
ll = [x for x in ...
2
votes
1answer
71 views
Better way to avoid trapping vars in a closure's scope?
I have a quandary with regard to exactly how the JavaScript scope chain works in a particular situation, and despite my searching and reading I am still mainly working on assumptions. I was wondering ...