for loop in typescript for array code example
Example 1: typescript foreach
let num = [7, 8, 9];
num.forEach(function (value) {
console.log(value);
});
Example 2: create an array for looping typescript
loopTimes: number[] = Array(31);
for (let x = 0; x < loopTimes.length; x++) {
console.log('Index/Loop No: ', [x]);
// Do something here...
}