Check out example codes for "create an array for looping typescript". It will help you in understanding the concepts better.

Code Example 1

loopTimes: number[] = Array(31);

for (let x = 0; x < loopTimes.length; x++) {
    console.log('Index/Loop No: ', [x]);
    // Do something here...
}

Learn ReactJs, React Native from akashmittal.com