TypeScript For Loop Statement

The for statement will execute a block of code, when you already know how many times script should perform or you want loop through a block of code to specific number of time.

Syntax

for (variable=startindex; variable<=endindex; variable=variable+increment) 
{
// Code block to be executed.
}

TypeScript For In Loop Example 1

Display():number
{
	for (var j=0; j<=10; j++)
	{
	   count =+ j;
	}
  return count;      
}
								
Try it Yourself