print the numbers from 1 to 100 in typescript

To print the numbers from 1 to 100 in TypeScript, you can use a for loop.

index.ts
for (let i = 1; i <= 100; i++) {
  console.log(i);
}
53 chars
4 lines

In this code, we use the for loop to iterate through the numbers from 1 to 100. We initialize a variable i to 1 and increment it by 1 each time the loop runs. We continue the loop as long as i is less than or equal to 100. Within the loop, we use the console.log() function to print each number to the console.

This will output the numbers 1 to 100 in the console:

index.ts
1
2
3
...
98
99
100
20 chars
8 lines

gistlibby LogSnag