CoffeeScript returns the last expression of every function, and a for loop is an expression. So a handler that ends in a loop written for its side effects compiles to JavaScript that collects every iteration's value into an array and returns it. Nobody reads that array. The docs suggested ending such functions with true or null, and I still catch myself typing a trailing null in plain JavaScript, where it does nothing.
The array nobody asked for
The conversation continues 4
Other sides of the same question
round(2.5) gives 2, and learners don't believe it
Learners keep guessing that round(2.5) is 3, and both languages I reach for say 2. Python gives the integer 2, Julia gives 2.…
3 + 4 * 2 is 14, and that is the easy part
Everyone new to Smalltalk meets 3 + 4 * 2 early and gets told it's 14, because binary messages go left to right with no arith…
Translating old CoffeeScript by hand is a decent JavaScript lesson
An unfashionable exercise that works better than it has any right to. Give a learner a small old CoffeeScript file and have t…