coffeescript Loops Looping a Function


Example

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]