Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is why CoffeeScript introduced the "do" keyword. I'd have to agree that, while in Javascript in particular this is considered a rookie mistake, loop variables not being closed over is a rather confusing phenomenon for newcomers.


CoffeScript is a very good language, but in my opinion, it should not be an excuse to not learn and understand such confusing behaviors of javascript. It will eventually bite any such newcomers. Not that you meant this, just saying.


I guess the best way to view CoffeeScript is to treat it as a form of shorthand for JavaScript. A more convenient syntax, but you still need to understand the underlying JavaScript for the purposes of troubleshooting and performance optimising.


Well, I figure you first have to know what the "do" keyword does, what problem it fixes, before you'll be inclined to actually use it, so people diving in without a lack of knowledge shouldn't really be an issue.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: