coffeescript

Loops

Looping a Function

The following codes will output the numbers 1 through 10 in the console, although console.log could be any function that accepts an input.

Method 1 - Standard

for x in [1..10]
    console.log x

Method 2 - Compact

console.log x for x in [1..10]

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow