simple loop in coffeescript

coffeescript

Solution

In CoffeeScript, you need to use the `by` keyword to specify the step of a loop. In your case:

for x in [1...count] by 1
  ...

Problem

I have this code: ``` count = $content.find('.post').length; for x in [1...count] /* prev_el_height += $("#content .post:nth-child(" + x + ")").height(); */ prev_el_height += $content.find(".post:nth-child(" + x + ")").height(); ``` I expected this to turn into ``` for (x = 1; x < count; x++) { prev_el ... } ``` but it turns into this: ``` for (x = 1; 1 <= count ? x < count : x > count; 1 <= count ? x++ : x--) { ``` Can somebody please explain why? EDIT: How do I get my expected syntax to output?

Original source