Loops

Other topics

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]

Contributors

Topic Id: 6006

Example Ids: 21014

This site is not affiliated with any of the contributors.